pub struct Error(_);
Expand description

A standard error type for network services.

An error consists of several components:

  • The cause of the error, represented as a type implementing the Rust Error trait. The cause can either be declared safe or unsafe to log.
  • The error’s kind, indicating how the service should handle the error e.g. in a response to a client.
  • Backtraces, including one taken at the time the error was created.
  • Parameters adding extra context about the error. They can be declared either safe or unsafe to log.

Note that this type does not implement the standard library’s Error trait.

Implementations

Creates a service error with an unsafe cause.

Creates a service error with a safe cause.

Creates a service error from a propagated error description and an unsafe cause.

Creates a service error from a propagated error description and a safe cause.

Creates an error indicating that the client should throttle itself with an unsafe cause.

Creates an error indicating that the client should throttle itself with a safe cause.

Creates an error indicating that the client should throttle itself for a specific duration with an unsafe cause.

Creates an error indicating that the client should throttle itself for a specific duration with a safe cause.

Creates an error indicating that the server was unable to serve the client’s request with an unsafe cause.

Creates an error indicating that the server was unable to serve the client’s request with a safe cause.

A convenience function to construct an internal service error with an unsafe cause.

A convenience function to construct an internal service error with a safe cause.

Returns the error’s cause.

Use the cause_safe method to determine if the error is safe or not.

Returns whether or not the error’s cause is considered safe.

Returns kind-specific error information.

Adds a new safe parameter to the error.

Panics

Panics if the value fails to serialize.

Adds a new unsafe parameter to the error.

Panics

Panics if the value fails to serialize.

Returns the error’s safe parameters.

Returns the error’s unsafe parameters.

Adds a new backtrace to the error.

An error always takes a backtrace at the time of its construction, but this method can be used to add extra backtraces to it. For example, this might be used when transferring an error from one thread to another.

Returns the error’s backtraces, ordered from oldest to newest.

Trait Implementations

Formats the value using the given formatter. Read more

Auto Trait Implementations

Blanket Implementations

Gets the TypeId of self. Read more

Immutably borrows from an owned value. Read more

Mutably borrows from an owned value. Read more

Returns the argument unchanged.

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

The type returned in the event of a conversion error.

Performs the conversion.

The type returned in the event of a conversion error.

Performs the conversion.