2021-02-04 17:43:36 +01:00
|
|
|
/// Error that happens within the database module.
|
2021-02-04 21:47:22 +01:00
|
|
|
#[derive(thiserror::Error, Debug)]
|
|
|
|
|
pub enum Error {
|
2021-02-04 17:43:36 +01:00
|
|
|
#[error(transparent)]
|
|
|
|
|
ConnectionError(#[from] diesel::result::ConnectionError),
|
|
|
|
|
|
|
|
|
|
#[error(transparent)]
|
|
|
|
|
MigrationsError(#[from] diesel_migrations::RunMigrationsError),
|
|
|
|
|
|
|
|
|
|
#[error(transparent)]
|
|
|
|
|
QueryError(#[from] diesel::result::Error),
|
|
|
|
|
|
|
|
|
|
#[error(transparent)]
|
|
|
|
|
SendError(#[from] std::sync::mpsc::SendError<super::thread::Action>),
|
|
|
|
|
|
|
|
|
|
#[error(transparent)]
|
2021-04-25 22:33:40 +02:00
|
|
|
ReceiveError(#[from] tokio::sync::oneshot::error::RecvError),
|
2021-02-04 17:43:36 +01:00
|
|
|
|
|
|
|
|
#[error("Database error: {0}")]
|
|
|
|
|
Other(String),
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/// Return type for database methods.
|
2021-02-04 21:47:22 +01:00
|
|
|
pub type Result<T> = std::result::Result<T, Error>;
|