pub enum Error {
InvalidArgs(Vec<String>),
NotFound(String),
Conflict(String),
InvalidEntity(Vec<String>),
Internal,
}
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.
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
.
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.
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.
Trait Implementations§
Source§impl IntoResponse for Error
impl IntoResponse for Error
Source§fn into_response(self) -> Response
fn into_response(self) -> Response
Create a response.
Auto Trait Implementations§
impl Freeze for Error
impl RefUnwindSafe for Error
impl Send for Error
impl Sync for Error
impl Unpin for Error
impl UnwindSafe for Error
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more