Mystem wrapper reworked.

This commit is contained in:
AB
2020-12-10 14:46:19 +03:00
parent 375015efff
commit cfe510029e
5 changed files with 101 additions and 36 deletions

View File

@ -2,10 +2,11 @@ use reqwest::Error as reqwest_error;
use rusqlite::Error as sqlite_error;
use serde_json::Error as serde_error;
use std::{fmt, io::Error as io_error};
use subprocess::PopenError as popen_error;
use telegram_bot::Error as tg_error;
#[derive(Debug)]
pub(crate) enum Error {
pub enum Error {
UserNotFound,
SQLITE3Error(sqlite_error),
TelegramError(tg_error),
@ -16,6 +17,7 @@ pub(crate) enum Error {
IOError(io_error),
FileNotFound,
JsonParseError(serde_error),
PopenError(popen_error),
}
impl fmt::Display for Error {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
@ -52,3 +54,9 @@ impl From<serde_error> for Error {
return Error::JsonParseError(e);
}
}
impl From<popen_error> for Error {
fn from(e: popen_error) -> Error {
return Error::PopenError(e);
}
}