mirror of
https://github.com/house-of-vanity/desubot.git
synced 2025-07-08 13:04:06 +00:00
Many improvements
This commit is contained in:
@ -1,14 +1,18 @@
|
||||
use reqwest::Error as reqwest_error;
|
||||
use rusqlite::Error as sqlite_error;
|
||||
use rusqlite::{named_params, params, Connection, Result};
|
||||
use std::{fmt, io, io::Error as io_error};
|
||||
use telegram_bot::Error as tg_error;
|
||||
use std::{fmt, io};
|
||||
|
||||
#[derive(Debug)]
|
||||
pub(crate) enum Error {
|
||||
UserNotFound,
|
||||
SQLITE3Error(sqlite_error),
|
||||
TelegramError(tg_error),
|
||||
ReqwestError(reqwest_error),
|
||||
ConfNotFound,
|
||||
IOError(io_error),
|
||||
FileNotFound,
|
||||
}
|
||||
impl fmt::Display for Error {
|
||||
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
|
||||
@ -26,4 +30,16 @@ impl From<tg_error> for Error {
|
||||
fn from(e: tg_error) -> Error {
|
||||
return Error::TelegramError(e);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
impl From<reqwest_error> for Error {
|
||||
fn from(e: reqwest_error) -> Error {
|
||||
return Error::ReqwestError(e);
|
||||
}
|
||||
}
|
||||
|
||||
impl From<io_error> for Error {
|
||||
fn from(e: io_error) -> Error {
|
||||
return Error::IOError(e);
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user