mirror of
https://github.com/house-of-vanity/desubot.git
synced 2025-07-08 13:04:06 +00:00
29 lines
670 B
Rust
29 lines
670 B
Rust
![]() |
use rusqlite::Error as sqlite_error;
|
||
|
use rusqlite::{named_params, params, Connection, Result};
|
||
|
use telegram_bot::Error as tg_error;
|
||
|
use std::{fmt, io};
|
||
|
|
||
|
#[derive(Debug)]
|
||
|
pub(crate) enum Error {
|
||
|
UserNotFound,
|
||
|
SQLITE3Error(sqlite_error),
|
||
|
TelegramError(tg_error),
|
||
|
ConfNotFound,
|
||
|
}
|
||
|
impl fmt::Display for Error {
|
||
|
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
|
||
|
write!(f, "An error occurred.")
|
||
|
}
|
||
|
}
|
||
|
|
||
|
impl From<sqlite_error> for Error {
|
||
|
fn from(e: sqlite_error) -> Error {
|
||
|
return Error::SQLITE3Error(e);
|
||
|
}
|
||
|
}
|
||
|
|
||
|
impl From<tg_error> for Error {
|
||
|
fn from(e: tg_error) -> Error {
|
||
|
return Error::TelegramError(e);
|
||
|
}
|
||
|
}
|