use std::fmt;
use modifier::Modifier;
use {Response};
pub use std::error::Error;
pub use hyper::Error as HttpError;
pub use hyper::error::Result as HttpResult;
#[derive(Debug)]
pub struct IronError {
pub error: Box<Error + Send>,
pub response: Response
}
impl IronError {
pub fn new<E: 'static + Error + Send, M: Modifier<Response>>(e: E, m: M) -> IronError {
IronError {
error: Box::new(e),
response: Response::with(m)
}
}
}
impl fmt::Display for IronError {
fn fmt(&self, f: &mut fmt::Formatter) -> Result<(), fmt::Error> {
fmt::Display::fmt(&*self.error, f)
}
}
impl Error for IronError {
fn description(&self) -> &str {
self.error.description()
}
fn cause(&self) -> Option<&Error> {
self.error.cause()
}
}