rsParser-r/src/error.rs
2023-09-18 01:01:49 +08:00

20 lines
444 B
Rust

use thiserror::Error;
use nom::Err;
#[derive(Error, Debug)]
pub enum BrokenError {
#[error("Can't Open file or file not exist.")]
IO(#[from] std::io::Error),
#[error("This file is not standard format.")]
ParseError,
}
impl<T> From<Err<T>> for BrokenError {
fn from(value: Err<T>) -> Self {
Self::ParseError
}
}
pub type AResult<O, E> = Result<Result<O,E>, BrokenError>;
pub type AAResult<O> = AResult<O, ()>;