Table of Contents

Class Error.Unexpected

Namespace
Trellis
Assembly
Trellis.Core.dll

HTTP 500 — a "shouldn't happen" condition. Used for default-initialized Result/Result<TValue>, exhausted match arms, or other internal invariant violations whose root cause is a programming error rather than a documented server-side fault.

public sealed record Error.Unexpected : Error, IEquatable<Error>, IEquatable<Error.Unexpected>
Inheritance
Error.Unexpected
Implements
Inherited Members
Extension Methods

Remarks

Distinct from Error.InternalServerError: that case carries an opaque per-incident FaultId for correlating with telemetry. Error.Unexpected identifies the kind of unexpected condition. Both map to HTTP 500 at the ASP boundary, but only Error.InternalServerError attaches a faultId extension to the problem-details payload.

Constructors

Unexpected(string)

HTTP 500 — a "shouldn't happen" condition. Used for default-initialized Result/Result<TValue>, exhausted match arms, or other internal invariant violations whose root cause is a programming error rather than a documented server-side fault.

public Unexpected(string ReasonCode)

Parameters

ReasonCode string

A stable, machine-readable identifier of the invariant that was violated (e.g. "default_initialized", "invariant_violation"). Distinct per logical cause; not a per-incident id.

Remarks

Distinct from Error.InternalServerError: that case carries an opaque per-incident FaultId for correlating with telemetry. Error.Unexpected identifies the kind of unexpected condition. Both map to HTTP 500 at the ASP boundary, but only Error.InternalServerError attaches a faultId extension to the problem-details payload.

Properties

Code

Gets the per-instance machine-readable code. Defaults to Kind; cases whose payload carries a per-instance ReasonCode override this.

public override string Code { get; }

Property Value

string

Kind

Gets the stable, IANA-aligned identifier for this case (e.g. "not-found", "unprocessable-content"). Suitable for telemetry, problem-details type URI synthesis, and wire serialization.

public override string Kind { get; }

Property Value

string

ReasonCode

A stable, machine-readable identifier of the invariant that was violated (e.g. "default_initialized", "invariant_violation"). Distinct per logical cause; not a per-incident id.

public string ReasonCode { get; init; }

Property Value

string