Many improvements

This commit is contained in:
AB
2020-12-05 15:57:11 +03:00
parent c848b4b632
commit b2bb016573
7 changed files with 264 additions and 31 deletions

View File

@ -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);
}
}