use core::fmt;
#[derive(Debug)]
pub enum CoreError {
Keyfile(String),
WrongPassword(String),
NotInRuntime(String),
Codec(String),
Crypto(String),
Device(String),
Rpc(String),
Policy(String),
}
impl fmt::Display for CoreError {
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
match self {
CoreError::Keyfile(msg) => write!(f, "keyfile error: {msg}"),
CoreError::WrongPassword(msg) => write!(f, "{msg}"),
CoreError::NotInRuntime(what) => write!(f, "{what} not found in this runtime"),
CoreError::Codec(msg) => write!(f, "codec error: {msg}"),
CoreError::Crypto(msg) => write!(f, "crypto error: {msg}"),
CoreError::Device(msg) => write!(f, "device error: {msg}"),
CoreError::Rpc(msg) => write!(f, "rpc error: {msg}"),
CoreError::Policy(msg) => write!(f, "policy error: {msg}"),
}
}
}
impl std::error::Error for CoreError {}