codec_cbor/deterministic/
error.rs1use thiserror::Error;
6
7#[derive(Debug, Clone, Copy, Error, PartialEq, Eq)]
9#[non_exhaustive]
10pub enum DeterministicCborProfileError {
11 #[error("deterministic CBOR: negative integer must be less than zero")]
14 NegativeIntegerMustBeNegative,
15}
16
17#[derive(Debug, Clone, Copy, Error, PartialEq, Eq)]
23#[non_exhaustive]
24pub enum DeterministicCborError {
25 #[error("deterministic CBOR: trailing bytes after top-level value")]
27 TrailingBytes,
28
29 #[error("deterministic CBOR: unexpected end of input")]
31 UnexpectedEnd,
32
33 #[error("deterministic CBOR: input too large")]
35 InputTooLarge,
36
37 #[error("deterministic CBOR: encoded output too large")]
39 OutputTooLarge,
40
41 #[error("deterministic CBOR: offset arithmetic overflow")]
43 OffsetOverflow,
44
45 #[error("deterministic CBOR: length does not fit in platform usize")]
47 LengthTooLarge,
48
49 #[error("deterministic CBOR: negative integer outside supported range")]
51 NegativeIntegerOutOfRange,
52
53 #[error("deterministic CBOR: negative integer must be less than zero")]
55 NegativeIntegerMustBeNegative,
56
57 #[error("deterministic CBOR: non-canonical integer or length encoding")]
59 NonCanonicalInteger,
60
61 #[error("deterministic CBOR: truncated numeric argument")]
63 TruncatedArgument,
64
65 #[error("deterministic CBOR: truncated byte or text string")]
67 TruncatedBytes,
68
69 #[error("deterministic CBOR: invalid UTF-8 string")]
71 InvalidUtf8,
72
73 #[error("deterministic CBOR: unsupported map key type")]
75 UnsupportedMapKeyType,
76
77 #[error("deterministic CBOR: duplicate map key")]
79 DuplicateMapKey,
80
81 #[error("deterministic CBOR: map keys out of deterministic order")]
83 MapKeysOutOfOrder,
84
85 #[error("deterministic CBOR: unsupported simple value")]
87 UnsupportedSimpleValue,
88
89 #[error("deterministic CBOR: unsupported major type")]
91 UnsupportedMajorType,
92
93 #[error("deterministic CBOR: unsupported additional information")]
95 UnsupportedAdditionalInfo,
96
97 #[error("deterministic CBOR: nesting depth limit exceeded")]
99 DepthExceeded,
100
101 #[error("deterministic CBOR: node limit exceeded")]
103 NodeLimitExceeded,
104
105 #[error("deterministic CBOR: container entry limit exceeded")]
107 ContainerEntriesExceeded,
108
109 #[error("deterministic CBOR: aggregate text byte limit exceeded")]
111 AggregateTextBytesExceeded,
112
113 #[error("deterministic CBOR: aggregate byte-string limit exceeded")]
115 AggregateByteStringBytesExceeded,
116
117 #[error("deterministic CBOR: declared container length exceeds remaining input")]
119 ContainerLengthExceedsInput,
120
121 #[error("deterministic CBOR: preflight length mismatch")]
123 PreflightLengthMismatch,
124
125 #[error("deterministic CBOR: bounded allocation failed")]
127 AllocationFailure,
128}
129
130impl From<DeterministicCborProfileError> for DeterministicCborError {
131 fn from(error: DeterministicCborProfileError) -> Self {
132 match error {
133 DeterministicCborProfileError::NegativeIntegerMustBeNegative => {
134 Self::NegativeIntegerMustBeNegative
135 }
136 }
137 }
138}