1use std::fmt;
3
4#[derive(Debug)]
6pub enum FbError {
7 DecodeError,
9
10 InvalidKey,
12
13 InvalidParams,
16}
17
18impl fmt::Display for FbError {
19
20 fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
21 let message = match self {
22 FbError::DecodeError => "Invalid input",
23 FbError::InvalidKey => "Invalid Key used",
24 FbError::InvalidParams => "One or more of the parameters are invalid or out of bounds. Valid bounds: (2 <= keybase_len <= cipher_len)",
25 };
26
27 f.write_fmt(format_args!("{message}"))
28 }
29}
30
31impl std::error::Error for FbError {}