#[non_exhaustive]pub enum Error {
UnterminatedBytes,
RedundantBytes,
OverFlow,
IndefiniteLength,
BadEoc,
ExtraContentsOctet,
UnmatchedId,
InvalidUtf8,
InvalidDerBooleanContents,
InvalidKeyValuePair,
Io(Error),
Anyhow(Error),
}
Expand description
Errors for this crate.
Variants (Non-exhaustive)§
This enum is marked as non-exhaustive
UnterminatedBytes
The bytes finish before the last octet.
RedundantBytes
The bytes include some redundant octet(s). (‘ASN.1’ does not allow such bytes.)
OverFlow
Over flow is occurred to parse bytes as a number.
IndefiniteLength
‘Indefinite length’ is used where not allowed. (It is only for BER of some type, but not for DER, nor for CER.)
BadEoc
The contents of ‘EOC’ of the ‘Indefinite Length BER’ must be empty.
ExtraContentsOctet
The contents include (an) invalid octet(s) at the end.
UnmatchedId
The identifier does not match to that of data type when deserialized.
InvalidUtf8
Invarid as UTF-8.
InvalidDerBooleanContents
The contents of DER BOOLEAN must be 0x00 or 0xFF.
InvalidKeyValuePair
The key-value pair is invalid.
Io(Error)
IO Error for serialization/deserialization.
Note that this error cannot be compared with others.
PartialEq::eq
always returns false
for this error.
Anyhow(Error)
Wrapper of anyhow::Error
.
Note that this error cannot be compared with others.
PartialEq::eq
always returns false
for this error.
Implementations§
Source§impl Error
impl Error
Sourcepub fn into_anyhow(self) -> Error
pub fn into_anyhow(self) -> Error
Consumes self
, converting it into an anyhow::Error
.
If self
matches Error::Anyhow
, returns the inner value;
otherwise, wraps self
and returns.
Sourcepub fn as_anyhow(&self) -> Option<&Error>
pub fn as_anyhow(&self) -> Option<&Error>
Returns a reference to the inner anyhow::Error
if self
is Error::Anyhow
;
otherwise, returns None
.
Sourcepub fn root_cause(&self) -> &Self
pub fn root_cause(&self) -> &Self
If self
matches Error::Anyhow
, returns a reference to the first Self
type error
in the chain; otherwise, returns self
.