pub enum JsonError {
UnexpectedToken {
expected: String,
found: String,
position: usize,
},
UnexpectedEndOfInput {
expected: String,
position: usize,
},
InvalidNumber {
value: String,
position: usize,
},
InvalidEscape {
char: char,
position: usize,
},
InvalidUnicode {
sequence: String,
position: usize,
},
}Expand description
Represents errors encountered while tokenizing or parsing JSON.
Each variant identifies a specific parsing failure and includes information about where the error occurred.
Variants§
UnexpectedToken
Occurs when the parser encounters a token that was not expected.
For example, an invalid character such as @ in JSON input.
UnexpectedEndOfInput
Occurs when JSON input ends before a required token is found.
For example, an array missing its closing bracket.
InvalidNumber
Occurs when a JSON number has an invalid format.
For example, a number with an invalid decimal or exponent.
InvalidEscape
Occurs when a JSON string contains an unsupported escape sequence.
For example, \q is not a valid JSON escape sequence.
InvalidUnicode
Occurs when a JSON string contains an invalid Unicode escape.
For example, \uZZZZ is not a valid Unicode escape.
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)>
1.0.0 · Source§fn description(&self) -> &str
fn description(&self) -> &str
use the Display impl or to_string()