mirror of
https://github.com/nushell/nushell.git
synced 2024-12-17 20:51:57 +01:00
add impl From io::Error and dyn Error for ShellError
This commit is contained in:
parent
c4ea398160
commit
9d49618e87
@ -97,4 +97,20 @@ pub enum ShellError {
|
||||
#[label("{destination_message}")]
|
||||
destination_span: Span,
|
||||
},
|
||||
|
||||
#[error("Move not possible")]
|
||||
#[diagnostic(code(nu::shell::move_not_possible_single), url(docsrs))]
|
||||
MoveNotPossibleSingle(String, #[label("{0}")] Span),
|
||||
}
|
||||
|
||||
impl From<std::io::Error> for ShellError {
|
||||
fn from(input: std::io::Error) -> ShellError {
|
||||
ShellError::InternalError(format!("{:?}", input))
|
||||
}
|
||||
}
|
||||
|
||||
impl From<Box<dyn std::error::Error + Send + Sync>> for ShellError {
|
||||
fn from(input: Box<dyn std::error::Error + Send + Sync>) -> ShellError {
|
||||
ShellError::InternalError(format!("{:?}", input))
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user