Class StreamError
- Namespace
- Kuestenlogik.Bowire
- Assembly
- Kuestenlogik.Bowire.dll
Why a server-streaming call stopped (#712).
public sealed record StreamError : IEquatable<StreamError>
- Inheritance
-
StreamError
- Implements
- Inherited Members
Remarks
The streaming contract had no way to say this. A frame is a JSON string
(or StreamFrame for plugins that expose wire bytes), so a
plugin that needed to report "this stream is over, and here is why" put
the reason in the payload — at the one place the consumer expects
payload. Twelve sites did that in four independently invented shapes,
and the gRPC plugin had grown a private ErrorCode field on its
own internal frame record, which is the clearest sign the contract was
missing a concept rather than a convenience.
What it cost: api.js parsed every frame as data and then set
status: 'OK'. Nothing in the handler recognised an error frame,
so an aborted stream was shown as a message and logged as "Completed".
Constructors
StreamError(string, string, string?)
Why a server-streaming call stopped (#712).
public StreamError(string Kind, string Message, string? Code = null)
Parameters
KindstringA short, lower-case word for the class of failure. See BowireStreamErrorKinds for the ones Bowire already uses.
MessagestringWhat to show the operator. Required.
CodestringThe wire protocol's own code when it has one — a gRPC status, an HTTP status, a broker's reason code. Null when the protocol has none.
Remarks
The streaming contract had no way to say this. A frame is a JSON string
(or StreamFrame for plugins that expose wire bytes), so a
plugin that needed to report "this stream is over, and here is why" put
the reason in the payload — at the one place the consumer expects
payload. Twelve sites did that in four independently invented shapes,
and the gRPC plugin had grown a private ErrorCode field on its
own internal frame record, which is the clearest sign the contract was
missing a concept rather than a convenience.
What it cost: api.js parsed every frame as data and then set
status: 'OK'. Nothing in the handler recognised an error frame,
so an aborted stream was shown as a message and logged as "Completed".
Properties
Code
The wire protocol's own code when it has one — a gRPC status, an HTTP status, a broker's reason code. Null when the protocol has none.
public string? Code { get; init; }
Property Value
Kind
A short, lower-case word for the class of failure. See BowireStreamErrorKinds for the ones Bowire already uses.
public string Kind { get; init; }
Property Value
Message
What to show the operator. Required.
public string Message { get; init; }
Property Value
Methods
Deconstruct(out string, out string, out string?)
public void Deconstruct(out string Kind, out string Message, out string? Code)
Parameters
Equals(StreamError?)
public bool Equals(StreamError? other)
Parameters
otherStreamError
Returns
Equals(object?)
public override bool Equals(object? obj)
Parameters
objobject
Returns
GetHashCode()
public override int GetHashCode()
Returns
ToString()
public override string ToString()
Returns
Operators
operator ==(StreamError?, StreamError?)
public static bool operator ==(StreamError? left, StreamError? right)
Parameters
leftStreamErrorrightStreamError
Returns
operator !=(StreamError?, StreamError?)
public static bool operator !=(StreamError? left, StreamError? right)
Parameters
leftStreamErrorrightStreamError