use thiserror::Error;
#[derive(Error, Debug)]
pub enum JsonError {
#[error("Unexpected error: {0}")]
UnexpectedError(String),
#[error("The parameter: \"{0}\" is invalid for reason: {1}")]
InvalidParameter(String, String),
#[error("Invalid operation: \"{0}\"")]
InvalidOperation(String),
#[error("Invalid path format")]
InvalidPathFormat,
#[error("Invalid path element: {0}")]
InvalidPathElement(String),
#[error("Unexpetec value reached while traversing path")]
BadPath,
#[error("Invalid JSON key or value")]
SerdeError(#[from] serde_json::Error),
#[error("Sub type name: {0} conflict with internal sub type name")]
ConflictSubType(String),
}
pub type Result<T> = std::result::Result<T, JsonError>;