Skip to main content

Module error

Module error 

Source
Expand description

The framework error type.

Every Rainier component fails with the same Error, and every Error carries the two things the HTTP layer needs to render it without knowing where it came from: an ErrorKind that maps to a status code, and an optional structured details payload.

That is what keeps the crate graph acyclic. rainier-validation cannot add a Validation variant to an enum in rainier-support (that would be a cycle), so instead it builds Error::validation(details) and the exception handler in rainier-http renders details as JSON. The same trick serves auth, authorization, and model-not-found — no component needs to know the others’ error types.

Structs§

Error
A framework error: a kind, a human message, an optional structured details payload, and an optional underlying cause.

Enums§

ErrorKind
The class of failure, which is also the HTTP status it renders as.

Traits§

Context
Adds .context(..) to any Result whose error converts into Error, the way anyhow::Context does — but preserving the ErrorKind when the error already is a Rainier error, so adding context to a 404 does not silently turn it into a 500.

Type Aliases§

Result
The framework result type.