Struct http_api_problem::ApiErrorBuilder [−][src]
pub struct ApiErrorBuilder {
pub status: StatusCode,
pub title: Option<String>,
pub message: Option<String>,
pub type_url: Option<String>,
pub instance: Option<String>,
pub fields: HashMap<String, Value>,
pub source: Option<Box<dyn Error + Send + Sync + 'static>>,
}
Fields
status: StatusCode
The suggested status code for the server to be returned to the client
title: Option<String>
This is an optional title which can be used to create a valuable output for consumers.
message: Option<String>
A message that describes the error in a human readable form.
In an HttpApiProblem this becomes the detail
in most cases.
type_url: Option<String>
A URL that points to a detailed description of the error.
instance: Option<String>
A URI reference that identifies the specific occurrence of the problem. It may or may not yield further information if dereferenced.
fields: HashMap<String, Value>
Additional JSON encodable information. It is up to the server how and if it adds the given information.
source: Option<Box<dyn Error + Send + Sync + 'static>>
Implementations
Set the StatusCode
pub fn try_status<T: TryInto<StatusCode>>(
self,
status: T
) -> Result<Self, InvalidStatusCode> where
T::Error: Into<InvalidStatusCode>,
pub fn try_status<T: TryInto<StatusCode>>(
self,
status: T
) -> Result<Self, InvalidStatusCode> where
T::Error: Into<InvalidStatusCode>,
Try to set the StatusCode
Fails if the status
argument can not be converted to a StatusCode
This is an optional title which can be used to create a valuable output for consumers.
A message that describes the error in a human readable form.
In an HttpApiProblem this becomes the detail
in most cases.
A URL that points to a detailed description of the error.
Sets the instance
A URI reference that identifies the specific occurrence of the problem. It may or may not yield further information if dereferenced.
Adds a serializable field.
If the serialization fails nothing will be added. An already present field with the same name will be replaced.
Trait Implementations
Performs the conversion.
Auto Trait Implementations
impl !RefUnwindSafe for ApiErrorBuilder
impl Send for ApiErrorBuilder
impl Sync for ApiErrorBuilder
impl Unpin for ApiErrorBuilder
impl !UnwindSafe for ApiErrorBuilder
Blanket Implementations
Mutably borrows from an owned value. Read more
Instruments this type with the provided Span
, returning an
Instrumented
wrapper. Read more
pub fn into_collection<A>(self) -> SmallVec<A> where
A: Array<Item = T>,
pub fn into_collection<A>(self) -> SmallVec<A> where
A: Array<Item = T>,
Converts self
into a collection.
type Output = T
type Output = T
Should always be Self
pub fn vzip(self) -> V
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
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