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
104 {104 {
105 Self::AuthenticationRequired(acp_error.message.clone().into())105 Self::AuthenticationRequired(acp_error.message.clone().into())
106 } else {106 } else {
107 let string = error.to_string();107 let string = format!("{:#}", error);
108 // TODO: we should have Gemini return better errors here.108 // TODO: we should have Gemini return better errors here.
109 if agent.clone().downcast::<agent_servers::Gemini>().is_some()109 if agent.clone().downcast::<agent_servers::Gemini>().is_some()
110 && string.contains("Could not load the default credentials")110 && string.contains("Could not load the default credentials")
@@ -113,7 +113,7 @@ impl ThreadError { · 2 unmodified lines
113 {113 {
114 Self::AuthenticationRequired(string.into())114 Self::AuthenticationRequired(string.into())
115 } else {115 } else {
116 Self::Other(error.to_string().into())116 Self::Other(string.into())
117 }117 }
118 }118 }
119 }119 }
@@ -795,7 +795,8 @@ impl AcpThreadView { · 675 unmodified lines
795 if let Some(load_err) = err.downcast_ref::<LoadError>() {795 if let Some(load_err) = err.downcast_ref::<LoadError>() {
796 self.thread_state = ThreadState::LoadError(load_err.clone());796 self.thread_state = ThreadState::LoadError(load_err.clone());
797 } else {797 } 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()))
799 }800 }
800 if self.message_editor.focus_handle(cx).is_focused(window) {801 if self.message_editor.focus_handle(cx).is_focused(window) {
801 self.focus_handle.focus(window)802 self.focus_handle.focus(window)