1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29
use std::error::Error; use std::fmt::{self, Display, Formatter}; use crate::serde_json::Error as JSONError; #[derive(Debug)] pub enum JSONGetTextValueError { IntegerOutOfRange, ParseError(JSONError), } impl Display for JSONGetTextValueError { #[inline] fn fmt(&self, f: &mut Formatter<'_>) -> fmt::Result { match self { JSONGetTextValueError::IntegerOutOfRange => f.write_str("The integer is out of range."), JSONGetTextValueError::ParseError(error) => Display::fmt(error, f), } } } impl Error for JSONGetTextValueError {} impl From<JSONError> for JSONGetTextValueError { #[inline] fn from(error: JSONError) -> JSONGetTextValueError { JSONGetTextValueError::ParseError(error) } }