1use core::fmt;
2
3#[derive(Debug, Copy, Clone, Eq, PartialEq)]
5pub enum Error {
6 MalformedSecretKey,
8 MalformedPublicKey,
10 InvalidSignature,
12 InvalidSliceLength,
14}
15
16impl fmt::Display for Error {
17 fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
18 let msg = match self {
19 Self::MalformedSecretKey => "Malformed secret key encoding.",
20 Self::MalformedPublicKey => "Malformed public key encoding.",
21 Self::InvalidSignature => "Invalid signature.",
22 Self::InvalidSliceLength => "Invalid length when parsing byte slice.",
23 };
24
25 msg.fmt(f)
26 }
27}
28
29#[cfg(feature = "std")]
30impl std::error::Error for Error {}