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

Kind string

A short, lower-case word for the class of failure. See BowireStreamErrorKinds for the ones Bowire already uses.

Message string

What to show the operator. Required.

Code string

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.

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

string

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

string

Message

What to show the operator. Required.

public string Message { get; init; }

Property Value

string

Methods

Deconstruct(out string, out string, out string?)

public void Deconstruct(out string Kind, out string Message, out string? Code)

Parameters

Kind string
Message string
Code string

Equals(StreamError?)

public bool Equals(StreamError? other)

Parameters

other StreamError

Returns

bool

Equals(object?)

public override bool Equals(object? obj)

Parameters

obj object

Returns

bool

GetHashCode()

public override int GetHashCode()

Returns

int

ToString()

public override string ToString()

Returns

string

Operators

operator ==(StreamError?, StreamError?)

public static bool operator ==(StreamError? left, StreamError? right)

Parameters

left StreamError
right StreamError

Returns

bool

operator !=(StreamError?, StreamError?)

public static bool operator !=(StreamError? left, StreamError? right)

Parameters

left StreamError
right StreamError

Returns

bool