simple_tables_core/
error.rs

1use std::fmt::{Debug, Display, Formatter};
2
3pub enum TableErrorKind {
4    CouldNotRemove
5}
6
7impl Debug for TableErrorKind {
8    fn fmt(&self, f: &mut Formatter<'_>) -> std::fmt::Result {
9        match self {
10            Self::CouldNotRemove => write!(f, "CouldNotRemove")
11        }
12    }
13}
14
15impl Display for TableErrorKind {
16    fn fmt(&self, f: &mut Formatter<'_>) -> std::fmt::Result {
17        write!(f, "{:?}", self)
18    }
19}
20
21pub struct TableError {
22    pub kind: TableErrorKind,
23    pub message: String
24}
25
26impl Display for TableError {
27    fn fmt(&self, f: &mut Formatter<'_>) -> std::fmt::Result {
28        write!(f, "{}", self.message)
29    }
30}
31
32impl Debug for TableError {
33    fn fmt(&self, f: &mut Formatter<'_>) -> std::fmt::Result {
34        write!(f, "{}: {}", self.kind, self.message)
35    }
36}
37
38impl std::error::Error for TableError {}