Class FaultCodes
- Namespace
- Trellis
- Assembly
- Trellis.Core.dll
The reason codes Trellis emits for outcomes that are not a validation failure of the caller's input — internal faults, and the conflicts and gaps a request can run into.
public static class FaultCodes
- Inheritance
-
FaultCodes
- Inherited Members
Remarks
Separate from ValidationCodes because none of these describes something wrong with a supplied value, so none belongs in the validation vocabulary a client walks to render field-level messages. They follow the same punctuation convention and are covered by the same test, so the framework's codes read consistently whichever family they belong to.
They differ in what a client may do with them. DefaultInitialized and
UnhandledException are internal faults carried by Error.Unexpected: they
mean the framework broke, prose about them is for an operator, and a client should never localize
against them. ConcurrentModification is not that — it rides on Error.Conflict,
it is the expected outcome of a lost write race rather than a defect, and a client may reasonably
present it to a user ("someone else changed this"). What they share is that Trellis itself
produces the value: some of them it also matches on to pick a status code, where a literal is a
silent dispatch break rather than a misspelt label. RateLimitExceeded, the
http.response-* family, and ResponseLocationUnresolved are emitted by
framework adapters; they are constants so that a caller can branch on a stable, aggregatable
code instead of parsing prose.
Fields
ConcurrentModification
A write lost a race: the row changed between read and save. Carried by
Error.Conflict, and surfaced as HTTP 412 when the request carried
If-Match, otherwise 409.
public const string ConcurrentModification = "concurrent-modification"
Field Value
DefaultInitialized
A Result was default-initialized and never assigned a success or failure.
public const string DefaultInitialized = "default-initialized"
Field Value
DuplicateKey
A write violates a unique constraint. Carried by Error.Conflict.
public const string DuplicateKey = "duplicate.key"
Field Value
HttpResponseFault
An HTTP response status has no more specific mapping in the status-to-error table. Carried by
Error.Unexpected and emitted by Trellis.Http's ToResultAsync.
public const string HttpResponseFault = "http.response-fault"
Field Value
HttpResponseInvalidBody
An HTTP response body could not be deserialized, or deserialized to null.
Carried by Error.Unexpected and emitted by Trellis.Http. The accompanying
Detail reports JSON line/byte position only — never body content.
public const string HttpResponseInvalidBody = "http.response-invalid-body"
Field Value
HttpResponseNoBody
An HTTP response that had to carry a body did not: 204/205, absent content, or a
zero-length payload. Carried by Error.Unexpected and emitted by Trellis.Http.
public const string HttpResponseNoBody = "http.response-no-body"
Field Value
HttpResponseNotSuccess
An HTTP response carried a non-success status on a path that needed its body. Carried by
Error.Unexpected and emitted by Trellis.Http's JSON readers.
public const string HttpResponseNotSuccess = "http.response-not-success"
Field Value
NotImplemented
A boundary reached a path the framework does not implement. Carried by
Error.Unexpected and surfaced as HTTP 501.
public const string NotImplemented = "not-implemented"
Field Value
RateLimitExceeded
ASP.NET Core rate-limiting middleware rejected a request before it reached the endpoint.
Carried by Error.RateLimited and emitted by Trellis.Asp.
public const string RateLimitExceeded = "rate-limit.exceeded"
Field Value
ReferentialIntegrity
A write violates a foreign-key constraint. Carried by Error.Conflict.
public const string ReferentialIntegrity = "referential.integrity"
Field Value
ResponseLocationUnresolved
A response was configured to emit a Location header but the URI could not be resolved.
Carried by Error.Unexpected and emitted by Trellis.Asp.
public const string ResponseLocationUnresolved = "response.location-unresolved"
Field Value
RetryAborted
A retryable save failure was aborted by the regenerate callback. Carried by Error.Conflict.
public const string RetryAborted = "retry.aborted"
Field Value
RetryExhausted
A retryable save failure exhausted the allowed attempts. Carried by Error.Conflict.
public const string RetryExhausted = "retry.exhausted"
Field Value
StateMachineInvalidTransition
A trigger was rejected because the aggregate's current state forbids it. Carried by
Error.InvariantViolation and surfaced as HTTP 422. Emitted by
Trellis.StateMachine's FireResult; the code lives here so it is covered by the
same punctuation guard as every other framework code.
public const string StateMachineInvalidTransition = "state-machine.invalid-transition"
Field Value
UnhandledException
An exception escaped to a boundary that converts it into a failed Result.
public const string UnhandledException = "unhandled-exception"