pub struct JsonError(/* private fields */);Expand description
An error that occurred while encoding or decoding a JSON body.
JSON bodies are encoded and decoded with sonic-rs, or with serde_json
when the serde feature is enabled. Errors of both crates convert into
JsonError.
The Display text is a single line. It does not include the input
fragment that sonic-rs appends to syntax errors.
Implementations§
Source§impl JsonError
impl JsonError
Sourcepub fn line(&self) -> usize
pub fn line(&self) -> usize
Returns the one-based line of the input at which the error occurred.
Returns 0 if the error has no input position, for example an
encoding error.
Sourcepub fn column(&self) -> usize
pub fn column(&self) -> usize
Returns the one-based column of the input at which the error occurred.
Returns 0 if the error has no input position, for example an
encoding error.
Sourcepub fn is_io(&self) -> bool
pub fn is_io(&self) -> bool
Returns true if the error was caused by a failure to read or write
bytes on an I/O stream.
Trait Implementations§
Source§impl Error for JsonError
impl Error for JsonError
Source§fn source(&self) -> Option<&(dyn Error + 'static)>
fn source(&self) -> Option<&(dyn Error + 'static)>
1.0.0 · Source§fn description(&self) -> &str
fn description(&self) -> &str
use the Display impl or to_string()
Source§impl From<JsonError> for JsonPayloadError
impl From<JsonError> for JsonPayloadError
Source§fn from(err: JsonError) -> JsonPayloadError
fn from(err: JsonError) -> JsonPayloadError
Source§impl From<JsonError> for JsonPayloadError
impl From<JsonError> for JsonPayloadError
Source§impl ResponseError for JsonError
InternalServerError for JsonError
impl ResponseError for JsonError
InternalServerError for JsonError
Source§fn error_response(&self) -> Response
fn error_response(&self) -> Response
Source§impl<St> WebResponseError<St, DefaultError> for JsonError
InternalServerError for JsonError.
impl<St> WebResponseError<St, DefaultError> for JsonError
InternalServerError for JsonError.
Serialization errors are server-side failures, such as a Json<T> or
Form<T> responder failing to encode its value.