1mod sign_error {
2 #[derive(Debug)]
4 pub enum SignError {
5 InvalidMessageHash,
7 InvalidK,
10 }
11
12 #[cfg(feature = "std")]
13 impl std::error::Error for SignError {}
14
15 impl core::fmt::Display for SignError {
16 fn fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result {
17 match self {
18 Self::InvalidMessageHash => write!(f, "Invalid message hash"),
19 Self::InvalidK => write!(f, "Invalid k"),
20 }
21 }
22 }
23}
24pub use sign_error::SignError;
25
26mod verify_error {
27 #[derive(Debug)]
29 pub enum VerifyError {
30 InvalidPublicKey,
32 InvalidMessageHash,
34 InvalidR,
36 InvalidS,
38 }
39
40 #[cfg(feature = "std")]
41 impl std::error::Error for VerifyError {}
42
43 impl core::fmt::Display for VerifyError {
44 fn fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result {
45 match self {
46 Self::InvalidMessageHash => write!(f, "Invalid message hash"),
47 Self::InvalidPublicKey => write!(f, "Invalid public key"),
48 Self::InvalidR => write!(f, "Invalid r"),
49 Self::InvalidS => write!(f, "Invalid s"),
50 }
51 }
52 }
53}
54pub use verify_error::VerifyError;
55
56mod recover_error {
57 #[derive(Debug)]
59 pub enum RecoverError {
60 InvalidMessageHash,
62 InvalidR,
64 InvalidS,
67 InvalidV,
69 }
70
71 #[cfg(feature = "std")]
72 impl std::error::Error for RecoverError {}
73
74 impl core::fmt::Display for RecoverError {
75 fn fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result {
76 match self {
77 Self::InvalidMessageHash => write!(f, "Invalid message hash"),
78 Self::InvalidR => write!(f, "Invalid r"),
79 Self::InvalidS => write!(f, "Invalid s"),
80 Self::InvalidV => write!(f, "Invalid v"),
81 }
82 }
83 }
84}
85pub use recover_error::RecoverError;