blob: c82688c9d9ac35f6fad4f058abb13cc8076f3fc3 (
plain) (
tree)
|
|
use core::fmt;
pub type MLE<T> = Result<T, MLError>;
#[derive(Debug)]
pub struct MLError {
etype: ErrorType,
message: String,
}
#[derive(Debug)]
pub enum ErrorType {
ArgumentError
}
impl std::error::Error for MLError {
fn description(&self) -> &str {
&self.message
}
}
impl fmt::Display for MLError {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
match self.etype {
ErrorType::ArgumentError => write!(f, "ARGS")
}
}
}
impl MLError {
pub fn new(etype: ErrorType, message: &str) -> Self {
Self { etype, message: String::from(message) }
}
}
|