18 lines
502 B
Rust
18 lines
502 B
Rust
use teloxide::dispatching::DpHandlerDescription;
|
|
|
|
#[derive(thiserror::Error, Debug)]
|
|
pub enum BotError {
|
|
#[error("User visible error: {0}")]
|
|
UserVisibleError(String),
|
|
#[error(transparent)]
|
|
InternalError(#[from] anyhow::Error),
|
|
}
|
|
impl BotError {
|
|
pub fn user_visible(msg: impl Into<String>) -> Self {
|
|
Self::UserVisibleError(msg.into())
|
|
}
|
|
}
|
|
|
|
pub type BotResult<T = ()> = Result<T, BotError>;
|
|
pub type BotHandler = dptree::Handler<'static, BotResult, DpHandlerDescription>;
|