pub enum Error {
InvalidArgs(Vec<String>),
NotFound(String),
Conflict(String),
InvalidEntity(Vec<String>),
Internal,
}Available on crate feature
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.
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§
Auto Trait Implementations§
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