1#[cfg(feature = "alloc")]
4use alloc::string::String;
5
6use core::fmt;
7
8#[derive(Debug)]
10pub enum Error {
11 InvalidPrivateKey,
13 #[cfg(feature = "alloc")]
15 Derivation(String),
16}
17
18impl fmt::Display for Error {
19 fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
20 match self {
21 Self::InvalidPrivateKey => write!(f, "invalid private key"),
22 #[cfg(feature = "alloc")]
23 Self::Derivation(msg) => write!(f, "key derivation error: {msg}"),
24 }
25 }
26}
27
28#[cfg(feature = "std")]
29impl std::error::Error for Error {}