#[non_exhaustive]pub enum JsonError {
MissingContentType,
InvalidContentType(ToStrError),
UnsupportedMediaType,
ContentTooLarge,
BufferingFailure,
InvalidSyntax {
line: usize,
column: usize,
},
InvalidData {
line: usize,
column: usize,
},
}Available on crate feature
json only.Expand description
An error type that’s returned on failure when extracting or serializing the Json.
Variants (Non-exhaustive)§
This enum is marked as non-exhaustive
Non-exhaustive enums could have additional variants added in future. Therefore, when matching against variants of non-exhaustive enums, an extra wildcard arm must be added to account for any future variants.
MissingContentType
Returned when the request doesn’t have a Content-Type header.
InvalidContentType(ToStrError)
Returned when the Content-Type value can’t be converted to a string.
UnsupportedMediaType
Returned when the Content-Type has an unsupported media type.
ContentTooLarge
Returned when the content size exceeds the size limit.
BufferingFailure
Returned on failure when collecting the request body frames.
InvalidSyntax
Returned on syntax error when deserializing the body as JSON data.
InvalidData
Returned on semantically incorrect data when deserializing the body as JSON.
Trait Implementations§
Source§impl Error for JsonError
impl Error for JsonError
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()
Source§impl IntoResponse for JsonError
impl IntoResponse for JsonError
fn into_response(self) -> Response
Auto Trait Implementations§
impl Freeze for JsonError
impl RefUnwindSafe for JsonError
impl Send for JsonError
impl Sync for JsonError
impl Unpin for JsonError
impl UnwindSafe for JsonError
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