pub struct HttpValidationError {
pub status_code: u16,
pub errors: Vec<ValidationError>,
}Expand description
HTTP validation error that maps to status codes
Fields§
§status_code: u16§errors: Vec<ValidationError>Implementations§
Source§impl HttpValidationError
impl HttpValidationError
Sourcepub fn bad_request(errors: Vec<ValidationError>) -> Self
pub fn bad_request(errors: Vec<ValidationError>) -> Self
Create a bad request error (400)
Sourcepub fn unprocessable_entity(errors: Vec<ValidationError>) -> Self
pub fn unprocessable_entity(errors: Vec<ValidationError>) -> Self
Create an unprocessable entity error (422)
Sourcepub fn internal_error(message: impl Into<String>) -> Self
pub fn internal_error(message: impl Into<String>) -> Self
Create an internal server error (500)
Sourcepub fn is_client_error(&self) -> bool
pub fn is_client_error(&self) -> bool
Check if this is a client error (4xx)
Sourcepub fn is_server_error(&self) -> bool
pub fn is_server_error(&self) -> bool
Check if this is a server error (5xx)
Trait Implementations§
Source§impl Clone for HttpValidationError
impl Clone for HttpValidationError
Source§fn clone(&self) -> HttpValidationError
fn clone(&self) -> HttpValidationError
Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Debug for HttpValidationError
impl Debug for HttpValidationError
Source§impl Display for HttpValidationError
impl Display for HttpValidationError
Source§impl Error for HttpValidationError
impl Error for HttpValidationError
1.30.0 · Source§fn source(&self) -> Option<&(dyn Error + 'static)>
fn source(&self) -> Option<&(dyn Error + 'static)>
Returns the lower-level source of this error, if any. Read more
1.0.0 · Source§fn description(&self) -> &str
fn description(&self) -> &str
👎Deprecated since 1.42.0:
use the Display impl or to_string()
Auto Trait Implementations§
impl Freeze for HttpValidationError
impl RefUnwindSafe for HttpValidationError
impl Send for HttpValidationError
impl Sync for HttpValidationError
impl Unpin for HttpValidationError
impl UnsafeUnpin for HttpValidationError
impl UnwindSafe for HttpValidationError
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