nushell/src/errors.rs

23 lines
475 B
Rust
Raw Normal View History

2019-05-10 16:59:12 +00:00
use derive_new::new;
#[derive(Debug, new)]
pub struct ShellError {
title: String,
}
impl std::fmt::Display for ShellError {
fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
write!(f, "{}", &self.title)
}
}
impl std::error::Error for ShellError {}
impl std::convert::From<std::io::Error> for ShellError {
fn from(input: std::io::Error) -> ShellError {
ShellError {
title: format!("{}", input),
}
}
}