use std::fmt;
use std::error::Error;
#[derive(Debug)]
pub struct GFError {
pub description: String,
}
impl GFError {
pub fn new(s: String) -> GFError {
GFError { description: s}
}
}
impl<T: Error> From<T> for GFError
{
fn from(e: T) -> GFError {
GFError {
description: format!("{}", e),
}
}
}
impl fmt::Display for GFError {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
write!(f, "{}", self.description)
}
}