forked from extern/nushell
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:
@ -6,10 +6,10 @@ use std::time::Duration;
|
||||
use notify::{DebouncedEvent, RecommendedWatcher, RecursiveMode, Watcher};
|
||||
use nu_engine::{current_dir, eval_block, CallExt};
|
||||
use nu_protocol::ast::Call;
|
||||
use nu_protocol::engine::{CaptureBlock, Command, EngineState, Stack};
|
||||
use nu_protocol::engine::{CaptureBlock, Command, EngineState, Stack, StateWorkingSet};
|
||||
use nu_protocol::{
|
||||
Category, Example, IntoPipelineData, PipelineData, ShellError, Signature, Spanned, SyntaxShape,
|
||||
Value,
|
||||
format_error, Category, Example, IntoPipelineData, PipelineData, ShellError, Signature,
|
||||
Spanned, SyntaxShape, Value,
|
||||
};
|
||||
|
||||
// durations chosen mostly arbitrarily
|
||||
@ -219,9 +219,8 @@ impl Command for Watch {
|
||||
val.print(engine_state, stack)?;
|
||||
}
|
||||
Err(err) => {
|
||||
// TODO: this isn't as nice as the Miette errors. Find a way to print those.
|
||||
// Unfortunately can't just wrap err in PipelineData, PipelineData.print() doesn't work that way
|
||||
eprintln!("{err:?}");
|
||||
let working_set = StateWorkingSet::new(engine_state);
|
||||
eprintln!("{}", format_error(&working_set, &err));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user