mirror of
https://github.com/nushell/nushell.git
synced 2024-11-22 16:33:37 +01:00
Show errors when a prompt fails (#4585)
This commit is contained in:
parent
53b5012f1e
commit
41fa1ab656
@ -1,4 +1,4 @@
|
|||||||
use crate::is_perf_true;
|
use crate::{is_perf_true, utils::report_error};
|
||||||
use log::info;
|
use log::info;
|
||||||
use nu_cli::NushellPrompt;
|
use nu_cli::NushellPrompt;
|
||||||
use nu_engine::eval_subexpression;
|
use nu_engine::eval_subexpression;
|
||||||
@ -81,8 +81,7 @@ fn get_prompt_string(
|
|||||||
&mut stack,
|
&mut stack,
|
||||||
block,
|
block,
|
||||||
PipelineData::new(Span::new(0, 0)), // Don't try this at home, 0 span is ignored
|
PipelineData::new(Span::new(0, 0)), // Don't try this at home, 0 span is ignored
|
||||||
)
|
);
|
||||||
.ok();
|
|
||||||
if is_perf_true() {
|
if is_perf_true() {
|
||||||
info!(
|
info!(
|
||||||
"get_prompt_string (block) {}:{}:{}",
|
"get_prompt_string (block) {}:{}:{}",
|
||||||
@ -92,7 +91,14 @@ fn get_prompt_string(
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
ret_val
|
match ret_val {
|
||||||
|
Ok(ret_val) => Some(ret_val),
|
||||||
|
Err(err) => {
|
||||||
|
let working_set = StateWorkingSet::new(engine_state);
|
||||||
|
report_error(&working_set, &err);
|
||||||
|
None
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
Value::String { val: source, .. } => {
|
Value::String { val: source, .. } => {
|
||||||
let mut working_set = StateWorkingSet::new(engine_state);
|
let mut working_set = StateWorkingSet::new(engine_state);
|
||||||
|
Loading…
Reference in New Issue
Block a user