From 41fa1ab6561e7bd048f3705628546e18a5a026b1 Mon Sep 17 00:00:00 2001 From: JT <547158+jntrnr@users.noreply.github.com> Date: Mon, 21 Feb 2022 10:46:19 -0500 Subject: [PATCH] Show errors when a prompt fails (#4585) --- src/prompt_update.rs | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/src/prompt_update.rs b/src/prompt_update.rs index 033d9ca323..06df95ddfe 100644 --- a/src/prompt_update.rs +++ b/src/prompt_update.rs @@ -1,4 +1,4 @@ -use crate::is_perf_true; +use crate::{is_perf_true, utils::report_error}; use log::info; use nu_cli::NushellPrompt; use nu_engine::eval_subexpression; @@ -81,8 +81,7 @@ fn get_prompt_string( &mut stack, block, PipelineData::new(Span::new(0, 0)), // Don't try this at home, 0 span is ignored - ) - .ok(); + ); if is_perf_true() { info!( "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, .. } => { let mut working_set = StateWorkingSet::new(engine_state);