2022-08-29 16:59:22 +00:00
|
|
|
use crate::blocking::queue::QueueError;
|
2022-08-31 17:45:13 +00:00
|
|
|
use crate::FangError;
|
|
|
|
use diesel::r2d2::PoolError;
|
|
|
|
use diesel::result::Error as DieselError;
|
2021-12-05 06:19:08 +00:00
|
|
|
use std::io::Error as IoError;
|
|
|
|
|
2022-08-31 17:45:13 +00:00
|
|
|
impl From<IoError> for FangError {
|
|
|
|
fn from(error: IoError) -> Self {
|
2023-02-03 18:41:14 +00:00
|
|
|
let description = format!("{error:?}");
|
2022-08-31 17:45:13 +00:00
|
|
|
FangError { description }
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
impl From<QueueError> for FangError {
|
|
|
|
fn from(error: QueueError) -> Self {
|
2023-02-03 18:41:14 +00:00
|
|
|
let description = format!("{error:?}");
|
2022-08-31 17:45:13 +00:00
|
|
|
FangError { description }
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
impl From<DieselError> for FangError {
|
|
|
|
fn from(error: DieselError) -> Self {
|
|
|
|
Self::from(QueueError::DieselError(error))
|
|
|
|
}
|
2021-12-05 06:19:08 +00:00
|
|
|
}
|
|
|
|
|
2022-08-31 17:45:13 +00:00
|
|
|
impl From<PoolError> for FangError {
|
|
|
|
fn from(error: PoolError) -> Self {
|
|
|
|
Self::from(QueueError::PoolError(error))
|
2021-12-05 06:19:08 +00:00
|
|
|
}
|
|
|
|
}
|