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