pub enum ErrorCode {
TransportError,
ResolverError,
CacheMiss,
NotFound,
ValidationError,
AuthorizationError,
Timeout,
Conflict,
InternalError,
}Expand description
Canonical error code. Transport adapters project this into GraphQL errors, MQTT error topics, SSE error frames, etc.
§Why NotFound, AuthorizationError and Conflict exist
These three are not convenience aliases. Each separates two outcomes that must never be collapsed, because collapsing them turns a fail-closed decision into an indistinguishable one:
NotFoundvsErrorCode::CacheMiss: an authoritative store that holds no such entity is a fact about the data; a cache miss is a fact about the lookup path. A caller that retries aCacheMissagainst the authority must not silently succeed-as-empty on aNotFound.AuthorizationErrorvsErrorCode::ResolverError: a denial is a deliberate, audited policy outcome. A resolver that fails is a bug or a dependency fault. Reporting a denial asResolverErrormakes a revoked grant indistinguishable from a domain failure, so an operator cannot tell an attack from an outage.ConflictvsErrorCode::ValidationError: a compare-and-set that lost the race is a retryable outcome, not an invalid input. Sharing a code withValidationErrorwould tell the caller its input was wrong when its input was fine and merely stale.
Callers that must fail closed on a denial should match
ErrorCode::AuthorizationError and must not fall through to the
authority on it; see specs/core.toml [types.ErrorCode].
Variants§
TransportError
Transport-level failure.
ResolverError
Resolver could not fulfil the query.
CacheMiss
Authoritative miss and no resolver.
NotFound
The named resource does not exist at the authoritative store.
ValidationError
Input failed validation.
AuthorizationError
The principal is not permitted to perform this operation.
Timeout
Deadline exceeded.
Conflict
A concurrent modification lost the compare-and-set race.
InternalError
Unexpected internal failure.