use std::fmt::Display;
use serde::{de, ser};
#[derive(Debug, Clone, thiserror::Error)]
pub enum SerdeValueError {
#[error("{0}")]
Deserialize(String),
#[error("{0}")]
Serialize(String),
#[error("")]
EofWhileParsingList,
#[error("")]
EofWhileParsingObject,
#[error("")]
EofWhileParsingString,
#[error("")]
EofWhileParsingValue,
#[error("")]
ExpectedColon,
#[error("")]
ExpectedListCommaOrEnd,
#[error("")]
ExpectedObjectCommaOrEnd,
#[error("")]
ExpectedSomeIdent,
#[error("")]
ExpectedSomeValue,
#[error("")]
ExpectedDoubleQuote,
#[error("")]
InvalidEscape,
#[error("")]
InvalidNumber,
#[error("")]
NumberOutOfRange,
#[error("")]
InvalidUnicodeCodePoint,
#[error("")]
ControlCharacterWhileParsingString,
#[error("")]
KeyMustBeAString,
#[error("")]
ExpectedNumericKey,
#[error("")]
FloatKeyMustBeFinite,
#[error("")]
LoneLeadingSurrogateInHexEscape,
#[error("")]
TrailingComma,
#[error("")]
TrailingCharacters,
#[error("")]
UnexpectedEndOfHexEscape,
#[error("")]
RecursionLimitExceeded,
}
impl de::Error for SerdeValueError {
fn custom<T: Display>(msg: T) -> Self {
SerdeValueError::Deserialize(msg.to_string())
}
}
impl ser::Error for SerdeValueError {
fn custom<T: Display>(msg: T) -> Self {
SerdeValueError::Serialize(msg.to_string())
}
}