use thiserror::Error;
#[derive(Error, Debug)]
pub enum Error {
#[error("mail error: {0}")]
Mail(String),
#[error("slack error: {0}")]
Slack(String),
#[error("database error: {0}")]
Database(String),
#[error("channel not available: {0}")]
ChannelNotAvailable(String),
#[error("serialization error: {0}")]
Serialization(#[from] serde_json::Error),
#[error("{0}")]
Other(String),
}
impl Error {
pub fn mail(msg: impl Into<String>) -> Self {
Self::Mail(msg.into())
}
pub fn slack(msg: impl Into<String>) -> Self {
Self::Slack(msg.into())
}
pub fn database(msg: impl Into<String>) -> Self {
Self::Database(msg.into())
}
}