1#[derive(Debug)]
2pub struct RowNotFound {
3 pub table: &'static str,
4 pub id: String,
5}
6impl RowNotFound {
7 pub fn new(table: &'static str, id: String) -> RowNotFound {
8 RowNotFound { table, id }
9 }
10}
11impl std::fmt::Display for RowNotFound {
12 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
13 write!(f, "Row not found in {}: {}", self.table, self.id)
14 }
15}
16impl std::error::Error for RowNotFound {}
17
18#[derive(Debug)]
19pub struct ErrorTable(pub &'static str);
20
21impl std::fmt::Display for ErrorTable {
22 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
23 write!(f, "table: {}", self.0)
24 }
25}
26impl std::error::Error for ErrorTable {}
27
28#[derive(Debug)]
29pub struct LockFailed {
30 pub name: String,
31}
32impl LockFailed {
33 pub fn new(name: String) -> LockFailed {
34 LockFailed { name }
35 }
36}
37impl std::fmt::Display for LockFailed {
38 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
39 write!(f, "Lock Failed: {}", self.name)
40 }
41}
42impl std::error::Error for LockFailed {}