#[non_exhaustive]pub enum Error {
Cbor(String),
UnexpectedType(String),
Verify(String),
InvalidState(String),
AlgorithmMismatch {
declared: String,
expected: String,
},
KeyOperation(String),
LimitExceeded {
resource: String,
limit: usize,
},
Custom(String),
}Expand description
Errors returned by COSE/CWT operations in this crate.
Variants (Non-exhaustive)§
This enum is marked as non-exhaustive
Cbor(String)
Failed to encode or decode CBOR.
UnexpectedType(String)
A header, key or claim value was present but had an unexpected CBOR type.
Verify(String)
Signature, MAC or decryption verification failed.
InvalidState(String)
An operation was attempted in an invalid message lifecycle state.
AlgorithmMismatch
A declared message, header, or key algorithm did not match the expected algorithm.
Fields
KeyOperation(String)
A COSE_Key key_ops restriction forbids the requested operation.
LimitExceeded
A configured parser or processing resource limit was exceeded.
Custom(String)
Any other COSE/CWT protocol error (malformed message, algorithm mismatch, missing parameter, …).
Implementations§
Source§impl Error
impl Error
Sourcepub fn custom(msg: impl Into<String>) -> Self
pub fn custom(msg: impl Into<String>) -> Self
Builds an Error::Custom from anything that can become a string.
Sourcepub fn verify(msg: impl Into<String>) -> Self
pub fn verify(msg: impl Into<String>) -> Self
Builds an Error::Verify from anything that can become a string.
Sourcepub fn invalid_state(msg: impl Into<String>) -> Self
pub fn invalid_state(msg: impl Into<String>) -> Self
Builds an Error::InvalidState.
Sourcepub fn key_operation(msg: impl Into<String>) -> Self
pub fn key_operation(msg: impl Into<String>) -> Self
Builds an Error::KeyOperation.
Trait Implementations§
impl Eq for Error
Source§impl Error for Error
impl Error for Error
1.30.0 · Source§fn source(&self) -> Option<&(dyn Error + 'static)>
fn source(&self) -> Option<&(dyn Error + 'static)>
1.0.0 · Source§fn description(&self) -> &str
fn description(&self) -> &str
use the Display impl or to_string()