Struct http_api_problem::ApiErrorBuilder[][src]

pub struct ApiErrorBuilder {
    pub message: Option<String>,
    pub status: StatusCode,
    pub type_url: Option<String>,
    pub fields: HashMap<String, Value>,
    pub title: Option<String>,
    pub source: Option<Box<dyn Error + Send + Sync + 'static>>,
}

Fields

message: Option<String>

A message that describes the error in a human readable form.

In an HttpApiProblem this becomes the detail in most cases.

If None:

  • If there is a cause, this will become the details
  • Otherwise there will be no details
status: StatusCode

The suggested status code for the server to be returned to the client

Defaults to 500.

type_url: Option<String>

A URL that points to a detailed description of the error. If not set it will most probably become httpstatus.es.com/XXX when the problem response is generated.

fields: HashMap<String, Value>

Additional JSON encodable information. It is up to the server how and if it adds the given information.

title: Option<String>

This is an optional title which can be used to create a valuable output for consumers.

source: Option<Box<dyn Error + Send + Sync + 'static>>

Implementations

impl ApiErrorBuilder[src]

pub fn status<S: Into<StatusCode>>(self, status: S) -> Self[src]

pub fn title<T: Into<String>>(self, title: T) -> Self[src]

pub fn message<M: Into<String>>(self, message: M) -> Self[src]

pub fn type_url<U: Into<String>>(self, type_url: U) -> Self[src]

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, cause: E) -> Self[src]

pub fn finish(self) -> ApiError[src]

Trait Implementations

impl Default for ApiErrorBuilder[src]

Auto Trait Implementations

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

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]

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]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.

impl<V, T> VZip<V> for T where
    V: MultiLane<T>, 

impl<T> WithSubscriber for T[src]