History

agent_ui: Render error context when failing to spawn agent thread (#41908)

Release Notes: - Fixed not telling the user what went wrong when spawning ACP agents

Lukas Wirth committed 1 year ago

Commit 75cef881 parent 46b39f01 file · +4 −3Browse files

Unified · Split

crates/agent_ui/src/acp/thread_view.rs+4−3
@@ -104,7 +104,7 @@ impl ThreadError { · 103 unmodified lines
104104 {
105105 Self::AuthenticationRequired(acp_error.message.clone().into())
106106 } else {
107− let string = error.to_string();
107+ let string = format!("{:#}", error);
108108 // TODO: we should have Gemini return better errors here.
109109 if agent.clone().downcast::<agent_servers::Gemini>().is_some()
110110 && string.contains("Could not load the default credentials")
@@ -113,7 +113,7 @@ impl ThreadError { · 2 unmodified lines
113113 {
114114 Self::AuthenticationRequired(string.into())
115115 } else {
116− Self::Other(error.to_string().into())
116+ Self::Other(string.into())
117117 }
118118 }
119119 }
@@ -795,7 +795,8 @@ impl AcpThreadView { · 675 unmodified lines
795795 if let Some(load_err) = err.downcast_ref::<LoadError>() {
796796 self.thread_state = ThreadState::LoadError(load_err.clone());
797797 } else {
798− self.thread_state = ThreadState::LoadError(LoadError::Other(err.to_string().into()))
798+ self.thread_state =
799+ ThreadState::LoadError(LoadError::Other(format!("{:#}", err).into()))
799800 }
800801 if self.message_editor.focus_handle(cx).is_focused(window) {
801802 self.focus_handle.focus(window)