pub enum CheckedJsonError {
NestingTooDeep {
depth: usize,
},
Syntax(Error),
}Expand description
Error returned by parse_json_checked: either the payload nests deeper than
MAX_JSON_NESTING_DEPTH or serde_json rejects it.
Distinct from a bare serde_json::Error so callers can branch on “too deep” vs.
“malformed” without string-matching a message, mirroring CheckedTomlError.
Variants§
NestingTooDeep
The payload nests deeper than MAX_JSON_NESTING_DEPTH.
Syntax(Error)
The payload passed the depth guard but serde_json rejected it.
Implementations§
Source§impl CheckedJsonError
impl CheckedJsonError
Sourcepub const fn kind(&self) -> ParseFailureKind
pub const fn kind(&self) -> ParseFailureKind
The ParseFailureKind this error maps to.
Sourcepub fn into_serde_json(self) -> Error
pub fn into_serde_json(self) -> Error
Flattens into a serde_json::Error for sites whose error type is fixed to it (for
instance DepsError::ApiResponse); a depth rejection is synthesized via
serde::de::Error::custom, indistinguishable from a serde_json-produced one.
Sourcepub fn into_deps_error(self, file_type: &str) -> DepsError
pub fn into_deps_error(self, file_type: &str) -> DepsError
Converts into a DepsError, naming file_type (for instance "package.json") in a
depth rejection’s message. A depth rejection becomes DepsError::ParseError of kind
ParseFailureKind::NestingTooDeep; a syntax error stays DepsError::Json.
Trait Implementations§
Source§impl Debug for CheckedJsonError
impl Debug for CheckedJsonError
Source§impl Display for CheckedJsonError
impl Display for CheckedJsonError
Source§impl Error for CheckedJsonError
impl Error for CheckedJsonError
Source§fn source(&self) -> Option<&(dyn Error + 'static)>
fn source(&self) -> Option<&(dyn Error + 'static)>
1.0.0 · Source§fn description(&self) -> &str
fn description(&self) -> &str
use the Display impl or to_string()
Source§impl From<CheckedJsonError> for DepsError
impl From<CheckedJsonError> for DepsError
Source§fn from(error: CheckedJsonError) -> Self
fn from(error: CheckedJsonError) -> Self
Same as CheckedJsonError::into_deps_error with the generic file type "JSON".