Skip to main content

kobe_eth/
error.rs

1//! Error types for Ethereum wallet operations.
2
3#[cfg(feature = "alloc")]
4use alloc::string::String;
5
6use core::fmt;
7
8/// Errors that can occur during Ethereum wallet operations.
9#[derive(Debug)]
10pub enum Error {
11    /// Invalid private key.
12    InvalidPrivateKey,
13    /// Key derivation error.
14    Derivation(String),
15}
16
17impl fmt::Display for Error {
18    fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
19        match self {
20            Self::InvalidPrivateKey => write!(f, "invalid private key"),
21            Self::Derivation(msg) => write!(f, "key derivation error: {msg}"),
22        }
23    }
24}
25
26#[cfg(feature = "std")]
27impl std::error::Error for Error {}