mirror of
https://github.com/johrpan/musicus.git
synced 2025-10-26 03:47:23 +01:00
24 lines
660 B
Rust
24 lines
660 B
Rust
/// Error that happens within the database module.
|
|
#[derive(thiserror::Error, Debug)]
|
|
pub enum Error {
|
|
#[error(transparent)]
|
|
Connection(#[from] diesel::result::ConnectionError),
|
|
|
|
#[error(transparent)]
|
|
Migrations(#[from] Box<dyn std::error::Error + Send + Sync>),
|
|
|
|
#[error(transparent)]
|
|
Query(#[from] diesel::result::Error),
|
|
|
|
#[error("Missing item dependency ({0} {1})")]
|
|
MissingItem(&'static str, String),
|
|
|
|
#[error("Failed to parse {0} from '{1}'")]
|
|
Parsing(&'static str, String),
|
|
|
|
#[error("{0}")]
|
|
Other(&'static str),
|
|
}
|
|
|
|
/// Return type for database methods.
|
|
pub type Result<T> = std::result::Result<T, Error>;
|