mirror of
https://github.com/johrpan/musicus.git
synced 2025-10-27 04:07:25 +01:00
27 lines
825 B
Rust
27 lines
825 B
Rust
/// Error that happens within the database module.
|
|
#[derive(thiserror::Error, Debug)]
|
|
pub enum Error {
|
|
#[error(transparent)]
|
|
ConnectionError(#[from] diesel::result::ConnectionError),
|
|
|
|
#[error(transparent)]
|
|
MigrationsError(#[from] diesel_migrations::RunMigrationsError),
|
|
|
|
#[error(transparent)]
|
|
QueryError(#[from] diesel::result::Error),
|
|
|
|
#[error("Missing item dependency ({0} {1})")]
|
|
MissingItem(&'static str, String),
|
|
|
|
#[error("Failed to parse {0} from '{1}'")]
|
|
ParsingError(&'static str, String),
|
|
|
|
#[error(transparent)]
|
|
SendError(#[from] std::sync::mpsc::SendError<super::thread::Action>),
|
|
|
|
#[error(transparent)]
|
|
ReceiveError(#[from] tokio::sync::oneshot::error::RecvError),
|
|
}
|
|
|
|
/// Return type for database methods.
|
|
pub type Result<T> = std::result::Result<T, Error>;
|