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

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.

Build the ApiError

Trait Implementations

Converts to this type from the input type.

Auto Trait Implementations

Blanket Implementations

Gets the TypeId of self. Read more

Immutably borrows from an owned value. Read more

Mutably borrows from an owned value. Read more

Returns the argument unchanged.

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more

Instruments this type with the current Span, returning an Instrumented wrapper. Read more

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Converts self into a collection.

Should always be Self

The type returned in the event of a conversion error.

Performs the conversion.

The type returned in the event of a conversion error.

Performs the conversion.

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