musicus/backend/src/error.rs

27 lines
732 B
Rust
Raw Normal View History

2021-02-04 21:47:22 +01:00
/// An error that can happened within the backend.
#[derive(thiserror::Error, Debug)]
pub enum Error {
#[error(transparent)]
ClientError(#[from] musicus_client::Error),
#[error(transparent)]
DatabaseError(#[from] musicus_database::Error),
2021-02-15 12:38:17 +01:00
#[cfg(target_os = "linux")]
2021-02-04 21:47:22 +01:00
#[error("An error happened using the SecretService.")]
SecretServiceError(#[from] secret_service::Error),
#[error("A channel was canceled.")]
ChannelError(#[from] futures_channel::oneshot::Canceled),
#[error("An error happened while decoding to UTF-8.")]
Utf8Error(#[from] std::str::Utf8Error),
#[error("An error happened: {0}")]
Other(&'static str),
}
pub type Result<T> = std::result::Result<T, Error>;