1pub enum Error {
2 BadCommand(String),
3 Operation(String),
4}
5
6impl std::fmt::Debug for Error {
7 fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
8 match self {
9 Error::BadCommand(s) => write!(f, "Bad command: {}", s),
10 Error::Operation(s) => write!(f, "Operation error: {}", s),
11 }
12 }
13}
14
15impl std::fmt::Display for Error {
16 fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
17 match self {
18 Error::BadCommand(s) => write!(f, "Bad command: {}", s),
19 Error::Operation(s) => write!(f, "Operation error: {}", s),
20 }
21 }
22}