use core::fmt;
#[derive(Copy, Clone, Debug)]
pub enum ErrorKind {
TypeError,
Unknown,
}
#[derive(Clone)]
pub struct Error {
pub kind: ErrorKind,
pub message: String,
}
impl std::error::Error for Error {}
impl Error {
pub fn new(kind: ErrorKind, message: String) -> Self {
Error { kind, message }
}
}
impl fmt::Debug for Error {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
f.write_str(&self.message)
}
}
impl fmt::Display for Error {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
f.write_str(&self.message)
}
}