chore: add source() implementation to internal sqlite::FailedTo error
This commit is contained in:
@@ -19,7 +19,20 @@ pub enum FailedTo {
|
|||||||
PrepareStatement(rusqlite::Error),
|
PrepareStatement(rusqlite::Error),
|
||||||
}
|
}
|
||||||
|
|
||||||
impl std::error::Error for FailedTo {}
|
impl std::error::Error for FailedTo {
|
||||||
|
fn source(&self) -> Option<&(dyn std::error::Error + 'static)> {
|
||||||
|
match self {
|
||||||
|
FailedTo::BeginTransaction(e) => Some(e),
|
||||||
|
FailedTo::BuildStatement => None,
|
||||||
|
FailedTo::CommitTransaction(e) => Some(e),
|
||||||
|
FailedTo::ExecuteBatch(e) => Some(e),
|
||||||
|
FailedTo::ExecuteQuery(e) => Some(e),
|
||||||
|
FailedTo::ExecuteStatement(e) => Some(e),
|
||||||
|
FailedTo::OpenConnection(e) => Some(e),
|
||||||
|
FailedTo::PrepareStatement(e) => Some(e),
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
impl std::fmt::Display for FailedTo {
|
impl std::fmt::Display for FailedTo {
|
||||||
fn fmt(&self, f: &mut std::fmt::Formatter) -> std::result::Result<(), std::fmt::Error> {
|
fn fmt(&self, f: &mut std::fmt::Formatter) -> std::result::Result<(), std::fmt::Error> {
|
||||||
|
|||||||
Reference in New Issue
Block a user