This commit is contained in:
AB
2020-12-27 23:04:09 +03:00
commit e421d6f382
6 changed files with 451 additions and 0 deletions

20
src/error.rs Normal file
View File

@ -0,0 +1,20 @@
use std::fmt;
use subprocess::PopenError;
#[derive(Debug)]
pub enum AppError {
PartOfSpeechError(&'static str),
GrammemError(&'static str),
PopenError(PopenError),
MystemError(&'static str),
}
impl fmt::Display for AppError {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
write!(f, "An error occurred.")
}
}
impl From<PopenError> for AppError {
fn from(e: PopenError) -> AppError {
return AppError::PopenError(e);
}
}