use thiserror::Error;
#[derive(Debug, Error)]
pub enum EngineError {
#[error("Mismatched closing character in the input JSON at position {0}.")]
DepthBelowZero(usize, #[source] DepthError),
#[error("Opening character at position {0} caused depth overflow.")]
DepthAboveLimit(usize, #[source] DepthError),
#[error("Malformed input JSON; end of input was reached, but unmatched opening characters remained.")]
MissingClosingCharacter(),
#[error(
"Malformed label in the input JSON; \
the colon at position {0} must be preceded by a string, but \
there are no matching double quote characters."
)]
MalformedLabelQuotes(usize),
#[error(transparent)]
NotSupported(#[from] crate::error::UnsupportedFeatureError),
}
#[derive(Error, Debug)]
pub enum DepthError {
#[error("Maximum depth of {0} exceeded.")]
AboveLimit(usize),
#[error("Depth fell below zero.")]
BelowZero,
}