pub type CborResult<T = ()> = Result<T, CborError>;
#[derive(thiserror::Error, Debug)]
pub enum CborError {
#[error("Invalid cbor: {0}")]
MalformedCbor(String),
#[error("Invalid cbor canister ranges")]
MalformedCborCanisterRanges,
#[error("Expected node with to have type {expected_type:?}, found {found_type:?}")]
UnexpectedCborNodeType {
expected_type: String,
found_type: String,
},
#[error("Error converting UTF8 string bytes: {0}")]
Utf8ConversionError(#[from] std::string::FromUtf8Error),
#[error(r#"Failed to parse certificate: "{0}""#)]
MalformedCertificate(String),
#[error(r#"Failed to parse hash tree: "{0}""#)]
MalformedHashTree(String),
#[error(r#"Invalid pruned data: "{0}""#)]
IncorrectPrunedDataLength(#[from] std::array::TryFromSliceError),
#[error("UnexpectedEndOfInput")]
UnexpectedEndOfInput,
}