Struct http_api_problem::ApiErrorBuilder [−][src]
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
impl ApiErrorBuilder
[src][−]
pub fn status<T: Into<StatusCode>>(self, status: T) -> Self
[src][−]
Set the StatusCode
pub fn try_status<T: TryInto<StatusCode>>(
self,
status: T
) -> Result<Self, InvalidStatusCode> where
T::Error: Into<InvalidStatusCode>,
[src][−]
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
pub fn title<T: Display>(self, title: T) -> Self
[src][−]
This is an optional title which can be used to create a valuable output for consumers.
pub fn message<M: Display>(self, message: M) -> Self
[src][−]
A message that describes the error in a human readable form.
In an HttpApiProblem this becomes the detail
in most cases.
pub fn type_url<U: Display>(self, type_url: U) -> Self
[src][−]
A URL that points to a detailed description of the error.
pub fn instance<T: Display>(self, instance: T) -> Self
[src][−]
Sets the instance
A URI reference that identifies the specific occurrence of the problem. It may or may not yield further information if dereferenced.
pub fn field<T: Into<String>, V: Serialize>(self, name: T, value: V) -> Self
[src][−]
Adds a serializable field.
If the serialization fails nothing will be added. An already present field with the same name will be replaced.
pub fn source<E: Error + Send + Sync + 'static>(self, source: E) -> Self
[src]
pub fn source_in_a_box<E: Into<Box<dyn Error + Send + Sync + 'static>>>(
self,
source: E
) -> Self
[src]
self,
source: E
) -> Self
pub fn finish(self) -> ApiError
[src][−]
Build the ApiError
Trait Implementations
impl From<ApiErrorBuilder> for ApiError
[src][+]
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
impl<T> Any for T where
T: 'static + ?Sized,
[src][+]
T: 'static + ?Sized,
impl<T> Borrow<T> for T where
T: ?Sized,
[src][+]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src][+]
T: ?Sized,
impl<T> From<T> for T
[src][+]
impl<T> Instrument for T
[src][+]
impl<T> Instrument for T
[src][+]
impl<T, U> Into<U> for T where
U: From<T>,
[src][+]
U: From<T>,
impl<T> Same<T> for T
type Output = T
Should always be Self
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src][+]
U: Into<T>,
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src][+]
U: TryFrom<T>,
impl<V, T> VZip<V> for T where
V: MultiLane<T>,
[+]
V: MultiLane<T>,