mirror of
https://github.com/nushell/nushell.git
synced 2025-08-19 05:36:04 +02:00
Better error handling using do
(#5890)
* adds `capture-errors` flag for `do` * adds `get-type` core command to get type * fmt * add tests in example * fmt * fix tests * manually revert previous changes related to `get-type` * adds method to check for error name using `into string` * fix clippy
This commit is contained in:
@@ -2,8 +2,8 @@ use nu_engine::CallExt;
|
||||
use nu_protocol::{
|
||||
ast::{Call, CellPath},
|
||||
engine::{Command, EngineState, Stack},
|
||||
Category, Config, Example, IntoPipelineData, PipelineData, ShellError, Signature, Span,
|
||||
SyntaxShape, Value,
|
||||
into_code, Category, Config, Example, IntoPipelineData, PipelineData, ShellError, Signature,
|
||||
Span, SyntaxShape, Value,
|
||||
};
|
||||
|
||||
// TODO num_format::SystemLocale once platform-specific dependencies are stable (see Cargo.toml)
|
||||
@@ -247,6 +247,15 @@ pub fn action(
|
||||
val: input.into_string(", ", config),
|
||||
span,
|
||||
},
|
||||
Value::Error { error } => Value::String {
|
||||
val: {
|
||||
match into_code(error) {
|
||||
Some(code) => code,
|
||||
None => "".to_string(),
|
||||
}
|
||||
},
|
||||
span,
|
||||
},
|
||||
Value::Nothing { .. } => Value::String {
|
||||
val: "".to_string(),
|
||||
span,
|
||||
|
Reference in New Issue
Block a user