Class HttpError
- Namespace
- Trellis
- Assembly
- Trellis.Http.Abstractions.dll
Closed discriminated union of HTTP-transport failures. Each case mirrors a status from
the IANA HTTP Status Code Registry (RFC 9110, RFC 6585) and carries header data needed
to emit an RFC-compliant response. Flows through Result<TValue> via the
envelope Error.TransportFault: new Error.TransportFault(new HttpError.NotAcceptable(...)).
public abstract record HttpError : ICodedTransportFault, ITransportFault, IEquatable<HttpError>
- Inheritance
-
HttpError
- Implements
- Derived
- Inherited Members
- Extension Methods
Remarks
Domain code does not construct or pattern-match HttpError. Construction is the
responsibility of HTTP-aware boundary code: server-side (Trellis.Asp) and
client-side (Trellis.Http).
Properties
Cause
Gets the optional structured cause of this HTTP fault. Never holds a live Exception; use a child HttpError to attach lower-level causal context.
public HttpError? Cause { get; init; }
Property Value
Code
Gets the machine-readable code for this fault. Defaults to Kind; cases whose payload identifies a specific conditional header override it.
public virtual string Code { get; }
Property Value
Detail
Gets optional human-readable detail. When non-null, boundary renderers prefer this over default templates for the fault.
public string? Detail { get; init; }
Property Value
Kind
Gets the stable, HTTP-aligned identifier for this case (for example
"method-not-allowed" or "precondition-failed").
public abstract string Kind { get; }
Property Value
Methods
Equals(HttpError?)
Value equality over the discriminator (Trellis.HttpError.EqualityContract) and Detail, plus each derived case's positional payload. Cause is intentionally excluded.
public virtual bool Equals(HttpError? other)
Parameters
otherHttpError
Returns
GetHashCode()
Serves as the default hash function.
public override int GetHashCode()
Returns
- int
A hash code for the current object.
ToString()
Returns a string that represents the current object.
public override string ToString()
Returns
- string
A string that represents the current object.