Module error

Module error 

Source
Expand description

Error representation during handling the request.

Tsukuyomi models the all errors generated during handling HTTP requests with a trait named HttpError. This trait is a method for converting itself into an HTTP response. The design of this trait imitates the failure crate, but there are some specialization considering of the HTTP context.

Structs§

Error
A custom trait object which holds all kinds of errors occurring in handlers.
ErrorResponse
An error type which wraps a Displayable value.

Traits§

HttpError
A trait representing error values to be converted into an HTTP response.

Functions§

bad_request
Equivalent to custom(StatusCode::BAD_REQUEST, msg).
custom
error_response
forbidden
Equivalent to custom(StatusCode::FORBIDDEN, msg).
internal_server_error
Equivalent to custom(StatusCode::INTERNAL_SERVER_ERROR, msg).
method_not_allowed
Equivalent to custom(StatusCode::METHOD_NOT_ALLOWED, msg).
not_found
Equivalent to custom(StatusCode::NOT_FOUND, msg).
unauthorized
Equivalent to custom(StatusCode::UNAUTHORIZED, msg).

Type Aliases§

Result
A type alias of Result<T, E> with error::Error as error type.