use alloc::string::FromUtf8Error;
#[cfg(feature = "alloc")]
#[allow(
unused_imports,
reason = "alloc prelude items; subset used per cfg/feature combination"
)]
use alloc::string::String;
use crate::core::matter::error::ValidationError;
use crate::stream::error::ParseError;
#[derive(Debug, thiserror::Error)]
pub enum SerderError {
#[error("JSON error: {0}")]
Json(#[from] serde_json::Error),
#[error("invalid version string: {0}")]
InvalidVersionString(String),
#[error("SAID mismatch: expected {expected}, computed {computed}")]
SaidMismatch {
expected: String,
computed: String,
},
#[error("unknown ilk: {0}")]
UnknownIlk(String),
#[error("missing field: {0}")]
MissingField(&'static str),
#[error("invalid primitive in field '{field}': {source}")]
InvalidPrimitive {
field: &'static str,
source: ValidationError,
},
#[error("digest error: {0}")]
DigestError(String),
#[error("encoding error: {0}")]
Encoding(#[from] FromUtf8Error),
#[error("qb64 encoding error: {0}")]
Qb64Encoding(#[from] ParseError),
#[error("validation error: {0}")]
Validation(String),
}