pub enum RavelError {
NotFound(String),
BadRequest(String),
Unauthorized(String),
Forbidden(String),
ValidationError(HashMap<String, Vec<String>>),
Internal(Error),
}Expand description
Unified error type that maps to HTTP responses.
Variants§
NotFound(String)
404 — resource not found.
BadRequest(String)
400 — malformed request.
401 — missing or invalid authentication.
Forbidden(String)
403 — authenticated but not permitted.
ValidationError(HashMap<String, Vec<String>>)
422 — validation failed. Keys are field names, values are error lists.
Internal(Error)
500 — unexpected internal error.
Implementations§
Source§impl RavelError
impl RavelError
Sourcepub fn bad_request(msg: impl Into<String>) -> Self
pub fn bad_request(msg: impl Into<String>) -> Self
Create a 400 Bad Request error.
Create a 401 Unauthorized error.
Trait Implementations§
Source§impl Debug for RavelError
impl Debug for RavelError
Source§impl From<Error> for RavelError
impl From<Error> for RavelError
Source§impl IntoResponse for RavelError
impl IntoResponse for RavelError
Source§fn into_response(self) -> Response
fn into_response(self) -> Response
Create a response.
Auto Trait Implementations§
impl Freeze for RavelError
impl RefUnwindSafe for RavelError
impl Send for RavelError
impl Sync for RavelError
impl Unpin for RavelError
impl UnsafeUnpin for RavelError
impl UnwindSafe for RavelError
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