1use std::fmt;
2
3#[derive(Debug, Clone, PartialEq, Eq)]
5pub enum Error {
6 InvalidDer(String),
8 InvalidPem(String),
10 InvalidIdentity(String),
12 NotFound(String),
14 Backend(String),
16 Unsupported(String),
18}
19
20impl fmt::Display for Error {
21 fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
22 match self {
23 Error::InvalidDer(e) => write!(f, "Invalid DER certificate: {e}"),
24 Error::InvalidPem(e) => write!(f, "Invalid PEM certificate: {e}"),
25 Error::InvalidIdentity(e) => write!(f, "Invalid identity: {e}"),
26 Error::NotFound(e) => write!(f, "Not found: {e}"),
27 Error::Backend(e) => write!(f, "Crypto backend error: {e}"),
28 Error::Unsupported(e) => write!(f, "Unsupported: {e}"),
29 }
30 }
31}
32
33impl std::error::Error for Error {}