1use std::{error::Error, fmt::Display};
3
4#[derive(Debug)]
6pub enum TransientError {
7 IncretmentError,
9 ParsingToByteError,
11 ParsingToUTF8Error,
13 SledError {
15 error: sled::Error,
17 },
18 SledTransactionError,
20 ParsingToU64ByteFailed,
22}
23
24impl Display for TransientError {
25 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
26 match self {
27 TransientError::IncretmentError => writeln!(f, "Incretment has failed"),
28 TransientError::ParsingToByteError => writeln!(f, "Parsing to byte failed"),
29 TransientError::ParsingToUTF8Error => writeln!(f, "Parsing to utf8 failed"),
30 TransientError::SledError { error } => writeln!(f, "Sled failed {}", error),
31 TransientError::SledTransactionError => writeln!(f, "Sled Transaction failed"),
32 TransientError::ParsingToU64ByteFailed => {
33 writeln!(f, "Failed to parse a variable to a U64 byte [u8; 8]")
34 }
35 }
36 }
37}
38
39impl Error for TransientError {}