1pub type CborResult<T = ()> = Result<T, CborError>;
2
3#[derive(thiserror::Error, Debug, Clone)]
4pub enum CborError {
5 #[error("Invalid cbor: {0}")]
7 MalformedCbor(String),
8
9 #[error("Invalid cbor canister ranges")]
11 MalformedCborCanisterRanges,
12
13 #[error("Expected node with to have type {expected_type:?}, found {found_type:?}")]
15 UnexpectedCborNodeType {
16 expected_type: String,
18 found_type: String,
20 },
21
22 #[error("Error converting UTF8 string bytes: {0}")]
24 Utf8ConversionError(#[from] std::string::FromUtf8Error),
25
26 #[error(r#"Failed to parse certificate: "{0}""#)]
28 MalformedCertificate(String),
29
30 #[error(r#"Failed to parse hash tree: "{0}""#)]
32 MalformedHashTree(String),
33
34 #[error(r#"Invalid pruned data: "{0}""#)]
36 IncorrectPrunedDataLength(#[from] std::array::TryFromSliceError),
37
38 #[error("UnexpectedEndOfInput")]
39 UnexpectedEndOfInput,
40}