pub enum Error {
    InvalidArgs(Vec<String>),
    Unauthorized(String),
    Forbidden(String),
    NotFound(String),
    Conflict(String),
    InvalidEntity(Vec<String>),
    Internal,
    ServiceUnavailable,
}axum only.Expand description
Error that can be used as axum response, with an appropriate HTTP status code and – except for
Internal – with one or more error messages conveyed as a JSON string array.
Variants§
InvalidArgs(Vec<String>)
400 Bad Request, e.g. because of invalid path or query arguments.
401 Unauthorized.
Forbidden(String)
403 Forbidden.
NotFound(String)
404 Not Found.
Conflict(String)
409 Conflict, e.g. because of an already existing resource.
InvalidEntity(Vec<String>)
422 Unprocessable Entity, e.g. because of the JSON payload could not be parsed.
Internal
500 Internal Server Error.
503 Service Unavailable.
Implementations§
Source§impl Error
 
impl Error
Sourcepub fn invalid_args<T>(error: T) -> Selfwhere
    T: ToString,
 
pub fn invalid_args<T>(error: T) -> Selfwhere
    T: ToString,
Create Error::InvalidArgs with the given error.
Sourcepub fn invalid_args_all<I, T>(errors: I) -> Selfwhere
    I: IntoIterator<Item = T>,
    T: ToString,
 
pub fn invalid_args_all<I, T>(errors: I) -> Selfwhere
    I: IntoIterator<Item = T>,
    T: ToString,
Create Error::InvalidArgs with the given errors.
Create Error::Unauthorized with the given error.
Sourcepub fn forbidden<T>(error: T) -> Selfwhere
    T: ToString,
 
pub fn forbidden<T>(error: T) -> Selfwhere
    T: ToString,
Create Error::Forbidden with the given error.
Sourcepub fn not_found<T>(error: T) -> Selfwhere
    T: ToString,
 
pub fn not_found<T>(error: T) -> Selfwhere
    T: ToString,
Create Error::NotFound with the given error.
Sourcepub fn conflict<T>(error: T) -> Selfwhere
    T: ToString,
 
pub fn conflict<T>(error: T) -> Selfwhere
    T: ToString,
Create Error::Conflict with the given error.
Sourcepub fn invalid_entity<T>(error: T) -> Selfwhere
    T: ToString,
 
pub fn invalid_entity<T>(error: T) -> Selfwhere
    T: ToString,
Create Error::InvalidEntity with the given error.
Sourcepub fn invalid_entity_all<I, T>(errors: I) -> Selfwhere
    I: IntoIterator<Item = T>,
    T: ToString,
 
pub fn invalid_entity_all<I, T>(errors: I) -> Selfwhere
    I: IntoIterator<Item = T>,
    T: ToString,
Create Error::InvalidEntity with the given errors.