From da09cbd05579e140e25df004b00939655f7d2697 Mon Sep 17 00:00:00 2001 From: Marshall Bowers Date: Fri, 15 Nov 2024 14:23:46 -0500 Subject: [PATCH] assistant: Show more details for assist errors (#20740) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This PR updates the Assistant to show more detailed error messages when the user encounters an assist error. Here are some examples: Screenshot 2024-11-15 at 1 47 03 PM Screenshot 2024-11-15 at 2 11 14 PM The notification will scroll if the error lines overflow the set maximum height. Release Notes: - Updated the Assistant to show more details in error cases. --- crates/assistant/src/assistant_panel.rs | 2 +- crates/assistant/src/context.rs | 6 +++++- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/crates/assistant/src/assistant_panel.rs b/crates/assistant/src/assistant_panel.rs index 3978d627d1..1a6e1c217e 100644 --- a/crates/assistant/src/assistant_panel.rs +++ b/crates/assistant/src/assistant_panel.rs @@ -3920,7 +3920,7 @@ impl ContextEditor { .child( div() .id("error-message") - .max_h_24() + .max_h_32() .overflow_y_scroll() .child(Label::new(error_message.clone())), ) diff --git a/crates/assistant/src/context.rs b/crates/assistant/src/context.rs index d16a0a7965..807d03ea5f 100644 --- a/crates/assistant/src/context.rs +++ b/crates/assistant/src/context.rs @@ -2383,7 +2383,11 @@ impl Context { }); Some(error.to_string()) } else { - let error_message = error.to_string().trim().to_string(); + let error_message = error + .chain() + .map(|err| err.to_string()) + .collect::>() + .join("\n"); cx.emit(ContextEvent::ShowAssistError(SharedString::from( error_message.clone(), )));