ex3_ic_agent/identity/
error.rs

1use thiserror::Error;
2
3/// An error happened while reading a PEM file.
4#[derive(Error, Debug)]
5pub enum PemError {
6    /// An error occurred with disk I/O.
7    #[error(transparent)]
8    Io(#[from] std::io::Error),
9
10    /// An unsupported curve was detected
11    #[error("Only secp256k1 curve is supported: {0:?}")]
12    UnsupportedKeyCurve(Vec<u8>),
13
14    /// An error occurred while reading the file in PEM format.
15    #[cfg(feature = "pem")]
16    #[error("An error occurred while reading the file: {0}")]
17    PemError(#[from] pem::PemError),
18
19    /// The key was rejected by Ring.
20    #[error("A key was rejected by Ring: {0}")]
21    KeyRejected(#[from] ring::error::KeyRejected),
22
23    /// The key was rejected by k256.
24    #[error("A key was rejected by k256: {0}")]
25    ErrorStack(#[from] k256::pkcs8::Error),
26}