mirror of
https://github.com/nushell/nushell.git
synced 2025-08-09 13:26:01 +02:00
Error printing changes for watch
(#5389)
* Move CliError to nu-protocol clean up comment * Enable printing errors instead of just returning them * Nicer Miette error printing in watch command
This commit is contained in:
@ -3,10 +3,10 @@ use nu_color_config::{get_color_config, style_primitive};
|
||||
use nu_engine::column::get_columns;
|
||||
use nu_engine::{env_to_string, CallExt};
|
||||
use nu_protocol::ast::{Call, PathMember};
|
||||
use nu_protocol::engine::{Command, EngineState, Stack};
|
||||
use nu_protocol::engine::{Command, EngineState, Stack, StateWorkingSet};
|
||||
use nu_protocol::{
|
||||
Category, Config, DataSource, Example, IntoPipelineData, ListStream, PipelineData,
|
||||
PipelineMetadata, RawStream, ShellError, Signature, Span, SyntaxShape, Value,
|
||||
format_error, Category, Config, DataSource, Example, IntoPipelineData, ListStream,
|
||||
PipelineData, PipelineMetadata, RawStream, ShellError, Signature, Span, SyntaxShape, Value,
|
||||
};
|
||||
use nu_table::{StyledString, TextStyle, Theme};
|
||||
use std::sync::atomic::{AtomicBool, Ordering};
|
||||
@ -141,7 +141,14 @@ impl Command for Table {
|
||||
}
|
||||
.into_pipeline_data())
|
||||
}
|
||||
PipelineData::Value(Value::Error { error }, ..) => Err(error),
|
||||
PipelineData::Value(Value::Error { error }, ..) => {
|
||||
let working_set = StateWorkingSet::new(engine_state);
|
||||
Ok(Value::String {
|
||||
val: format_error(&working_set, &error),
|
||||
span: call.head,
|
||||
}
|
||||
.into_pipeline_data())
|
||||
}
|
||||
PipelineData::Value(Value::CustomValue { val, span }, ..) => {
|
||||
let base_pipeline = val.to_base_value(span)?.into_pipeline_data();
|
||||
self.run(engine_state, stack, call, base_pipeline)
|
||||
|
Reference in New Issue
Block a user