Skip to main content

HttpError

Trait HttpError 

Source
pub trait HttpError {
    // Required methods
    fn status_code(&self) -> StatusCode;
    fn client_message(&self) -> Cow<'static, str>;
}
Available on native and crate feature core only.
Expand description

Application-defined error contract for HTTP response mapping.

Implementations must return client-safe messages. Server-side diagnostic details should remain in logs or the original error display output.

Required Methods§

Source

fn status_code(&self) -> StatusCode

Returns the HTTP status associated with this error.

Source

fn client_message(&self) -> Cow<'static, str>

Returns the client-facing message associated with this error.

Dyn Compatibility§

This trait is dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementors§