Trait http_problem::prelude::CustomProblem
source · [−]pub trait CustomProblem: Error + Send + Sync + 'static {
fn problem_type(&self) -> Uri;
fn title(&self) -> &'static str;
fn status_code(&self) -> StatusCode;
fn details(&self) -> CowStr;
fn add_extensions(&self, extensions: &mut Extensions);
}
Expand description
A trait defining custom problem types.
Implementing this trait provides enough information to create a
Problem
instance with the correct values for each field.
There is no need to implement From<Self> for Problem
if you
implement this trait.
See define_custom_type!
for a convenient way of implementing
this trait.
Required Methods
fn problem_type(&self) -> Uri
fn problem_type(&self) -> Uri
A URI reference that identifies the problem type.
See Problem::type_
more information.
A short, human-readable summary of the problem type.
See Problem::title
for more information.
fn status_code(&self) -> StatusCode
fn status_code(&self) -> StatusCode
The HTTP status code for this problem type.
See Problem::status
for more information.
A human-readable explanation of the occurrence.
See Problem::details
for more information.
fn add_extensions(&self, extensions: &mut Extensions)
fn add_extensions(&self, extensions: &mut Extensions)
Add extensions to the final problem instance.
See Problem::with_extension
for more info.