forest/key_management/
errors.rs1use std::io;
5
6use thiserror::Error;
7
8#[derive(Debug, Error)]
9pub enum Error {
10 #[error("Key info not found")]
12 KeyInfo,
13 #[error("Key already exists")]
15 KeyExists,
16 #[error("Key does not exist")]
17 KeyNotExists,
18 #[error("Key not found")]
19 NoKey,
20 #[error(transparent)]
21 Bls(#[from] bls_signatures::Error),
22 #[error(transparent)]
23 K256(#[from] k256::ecdsa::Error),
24 #[error(transparent)]
25 IO(#[from] io::Error),
26 #[error("{0}")]
27 Other(String),
28 #[error("Could not convert from KeyInfo to Key")]
29 KeyInfoConversion,
30}
31
32impl From<anyhow::Error> for Error {
33 fn from(value: anyhow::Error) -> Self {
34 Error::Other(value.to_string())
35 }
36}