use std::error;
use std::fmt;
use std::result;
pub type Result<T> = result::Result<T, Error>;
#[derive(Clone,Copy,Debug,Eq,PartialEq)]
pub enum Error {
Init,
FormAdd,
FormRun,
GridAdd,
ItemAdd,
WindowOpen
}
impl fmt::Display for Error {
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
match self {
Error::Init => write!(f, "Error initializing libnewt."),
Error::FormAdd => write!(f, "Component already belongs to a Form."),
Error::FormRun => write!(f, "Error running Form."),
Error::GridAdd => write!(f, "Grid already belongs to a parent."),
Error::ItemAdd => write!(f, "Error adding an item to a list widget."),
Error::WindowOpen => write!(f, "Error opening window.")
}
}
}
impl error::Error for Error { }