pub enum ErrorKind {
BadRequest,
Unauthenticated,
Unauthorized,
NotFound,
MethodNotAllowed,
Conflict,
PayloadTooLarge,
Validation,
TooManyRequests,
Internal,
ServiceUnavailable,
Status(u16),
}Expand description
The class of failure, which is also the HTTP status it renders as.
Each domain failure names its status (authentication → 401, validation → 422, …) so the “throw a domain error, get the right response” flow works without any component knowing the renderer.
Variants§
BadRequest
400 — the request was malformed.
Unauthenticated
401 — no (or invalid) credentials. Raised by guards.
403 — authenticated but not permitted. Raised by gates/policies.
NotFound
404 — no such route or model.
MethodNotAllowed
405 — the route exists but not for this method.
Conflict
409 — the request conflicts with current state.
PayloadTooLarge
413 — the body exceeded the configured limit.
Validation
422 — the request was well-formed but failed validation.
TooManyRequests
429 — throttled.
Internal
500 — an unhandled internal failure.
503 — the app is down for maintenance or a dependency is unavailable.
Status(u16)
Any other status, set explicitly.