Module tsukuyomi::error

source ·
Expand description

Components for constructing and handling HTTP errors.

Error Representation

Tsukuyomi models the all errors generated during handling HTTP requests with a trait named HttpError. This trait is a sub trait of Fail with additional methods for converting itself to an HTTP response.

The all of handling errors are managed in the framework by converting into an Error. They will be automatically converted to an HTTP response after all processeing will be completed.

Error Handling

The best way to specify the error responses is usually to return a value which implements HttpError. However, The error values after being converted to Error can be modified by using the following components:

  • ErrorHandler - It modifies the all kinds of errors which occurred during handling.
  • Modifier - It modifies errors occurred within a certain scope.

Structs

A type which holds all kinds of errors occurring in handlers.
An instance of HttpError which holds an HTTP status code and the message string.
An instance of HttpError which associates HTTP status code with a value of failure::Error.

Enums

A helper type emulating the standard never_type (!).

Traits

An extension trait for adding support for downcasting of HttpErrors.
A trait representing a global error handlers.
A trait representing error values to be converted into an HTTP response.

Functions

A helper function for creating the value of HttpError from a string.
A helper function for creating the value of HttpError from a string.

Type Definitions

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