Try DbErr::Custom
This commit is contained in:
parent
ef1eb577b7
commit
08595c9729
@ -1,8 +1,11 @@
|
|||||||
#[derive(Debug, PartialEq)]
|
use std::error::Error;
|
||||||
|
|
||||||
|
#[derive(Debug)]
|
||||||
pub enum DbErr {
|
pub enum DbErr {
|
||||||
Conn(String),
|
Conn(String),
|
||||||
Exec(String),
|
Exec(String),
|
||||||
Query(String),
|
Query(String),
|
||||||
|
Custom(Box<dyn Error>),
|
||||||
}
|
}
|
||||||
|
|
||||||
impl std::error::Error for DbErr {}
|
impl std::error::Error for DbErr {}
|
||||||
@ -13,6 +16,7 @@ impl std::fmt::Display for DbErr {
|
|||||||
Self::Conn(s) => write!(f, "Connection Error: {}", s),
|
Self::Conn(s) => write!(f, "Connection Error: {}", s),
|
||||||
Self::Exec(s) => write!(f, "Execution Error: {}", s),
|
Self::Exec(s) => write!(f, "Execution Error: {}", s),
|
||||||
Self::Query(s) => write!(f, "Query Error: {}", s),
|
Self::Query(s) => write!(f, "Query Error: {}", s),
|
||||||
|
Self::Custom(e) => write!(f, "Custom Error: {}", e),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user