Struct surf::Error[][src]

pub struct Error { /* fields omitted */ }
Expand description

The error type for HTTP operations.

Implementations

Create a new error object from any error type.

The error type must be threadsafe and ’static, so that the Error will be as well. If the error type does not provide a backtrace, a backtrace will be created here to ensure that a backtrace exists.

Create a new error object from static string.

Get the status code associated with this error.

Set the status code associated with this error.

Get the backtrace for this Error.

Backtraces are only available on the nightly channel. Tracking issue: rust-lang/rust#53487.

In order for the backtrace to be meaningful, the environment variable RUST_LIB_BACKTRACE=1 must be defined. Backtraces are somewhat expensive to capture in Rust, so we don’t necessarily want to be capturing them all over the place all the time.

Note: This function can be called whether or not backtraces are enabled and available. It will return a None variant if compiled on a toolchain that does not support backtraces, or if executed without backtraces enabled with RUST_LIB_BACKTRACE=1.

Returns the inner [anyhow::Error] Note: This will lose status code information

Attempt to downcast the error object to a concrete type.

Downcast this error object by reference.

Downcast this error object by mutable reference.

Retrieves a reference to the type name of the error, if available.

Converts anything which implements Display into an http_types::Error.

This is handy for errors which are not Send + Sync + 'static because std::error::Error requires Display. Note that any assiciated context not included in the Display output will be lost, and so this may be lossy for some types which implement std::error::Error.

Note: Prefer error.into() via From<Into<anyhow::Error>> when possible!

Converts anything which implements Debug into an http_types::Error.

This is handy for errors which are not Send + Sync + 'static because std::error::Error requires Debug. Note that any assiciated context not included in the Debug output will be lost, and so this may be lossy for some types which implement std::error::Error.

Note: Prefer error.into() via From<Into<anyhow::Error>> when possible!

Trait Implementations

Performs the conversion.

Performs the conversion.

Performs the conversion.

Performs the conversion.

Formats the value using the given formatter. Read more

Formats the value using the given formatter. Read more

Performs the conversion.

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

Performs the conversion.

Performs the conversion.

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more

Instruments this type with the current Span, returning an Instrumented wrapper. Read more

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more

Instruments this type with the current Span, returning an Instrumented wrapper. Read more

Performs the conversion.

Should always be Self

Converts the given value to a String. Read more

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.

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more