mirror of
https://github.com/nushell/nushell
synced 2025-01-03 16:58:58 +00:00
23 lines
475 B
Rust
23 lines
475 B
Rust
|
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),
|
||
|
}
|
||
|
}
|
||
|
}
|