1#[derive(Debug)]
2pub enum RnsError {
3 OutOfMemory,
4 InvalidArgument,
5 IncorrectSignature,
6 IncorrectHash,
7 CryptoError,
8 PacketError,
9 ConnectionError,
10 TimeSourceUnavailable,
15}
16
17impl core::fmt::Display for RnsError {
18 fn fmt(&self, formatter: &mut core::fmt::Formatter<'_>) -> core::fmt::Result {
19 formatter.write_str(match self {
20 Self::OutOfMemory => "allocation failed",
21 Self::InvalidArgument => "invalid argument",
22 Self::IncorrectSignature => "signature verification failed",
23 Self::IncorrectHash => "hash verification failed",
24 Self::CryptoError => "cryptographic operation failed",
25 Self::PacketError => "invalid packet",
26 Self::ConnectionError => "connection failed",
27 Self::TimeSourceUnavailable => {
28 "no wall-clock time source available (install one via \
29 ratchets::set_time_override in no_std builds)"
30 }
31 })
32 }
33}
34
35impl core::error::Error for RnsError {}