1use thiserror::Error;
2
3#[derive(Error, Debug)]
4pub enum JsonError {
5 #[error("Unexpected error: {0}")]
6 UnexpectedError(String),
7 #[error("The parameter: \"{0}\" is invalid for reason: {1}")]
8 InvalidParameter(String, String),
9 #[error("Invalid operation: \"{0}\"")]
10 InvalidOperation(String),
11 #[error("Invalid path format")]
15 InvalidPathFormat,
16 #[error("Invalid path element: {0}")]
20 InvalidPathElement(String),
21 #[error("Unexpetec value reached while traversing path")]
22 BadPath,
23 #[error("Invalid JSON key or value")]
25 SerdeError(#[from] serde_json::Error),
26 #[error("Sub type name: {0} conflict with internal sub type name")]
27 ConflictSubType(String),
28}
29
30pub type Result<T> = std::result::Result<T, JsonError>;