mirror of
https://github.com/coder/coder.git
synced 2026-06-02 20:48:20 +00:00
feat(site/src/pages/AgentsPage): show error details for generic errors (#25803)
Error messages in agent chat now expose the actual error detail
instead of hiding it entirely. Also captures API response detail
for generic errors that previously dropped it.
(cherry picked from commit 78d556fffc)
This commit is contained in:
@@ -1182,9 +1182,11 @@ const AgentChatPage: FC = () => {
|
||||
store.setStreamError(reason);
|
||||
setChatErrorReason(agentId, reason);
|
||||
} else if (isApiError(error)) {
|
||||
const detail = error.response?.data?.detail?.trim() || undefined;
|
||||
const reason: ChatDetailError = {
|
||||
kind: "generic",
|
||||
message: error.message || "An unexpected error occurred.",
|
||||
message: getErrorMessage(error, "An unexpected error occurred."),
|
||||
...(detail ? { detail } : {}),
|
||||
};
|
||||
store.setStreamError(reason);
|
||||
setChatErrorReason(agentId, reason);
|
||||
|
||||
@@ -164,11 +164,17 @@ const StatusAlert: FC<{ status: RetryOrFailedStatus }> = ({ status }) => {
|
||||
</Link>
|
||||
)}
|
||||
</span>
|
||||
{status.phase === "failed" && status.detail && (
|
||||
<span className="mt-1 block text-content-secondary">
|
||||
{status.detail}
|
||||
</span>
|
||||
)}
|
||||
{status.phase === "failed" &&
|
||||
status.detail &&
|
||||
(status.kind === "generic" ? (
|
||||
<code className="mt-1 block whitespace-pre-wrap text-xs text-content-secondary font-mono bg-surface-secondary rounded-md">
|
||||
{status.detail}
|
||||
</code>
|
||||
) : (
|
||||
<span className="mt-1 block text-content-secondary">
|
||||
{status.detail}
|
||||
</span>
|
||||
))}
|
||||
</AlertDescription>
|
||||
</Alert>
|
||||
);
|
||||
|
||||
@@ -351,7 +351,7 @@ export const GenericErrorDoesNotShowUsageAction: Story = {
|
||||
},
|
||||
};
|
||||
|
||||
/** Provider detail renders as a muted secondary line under the main error. */
|
||||
/** Provider detail renders in a monospace block for generic errors. */
|
||||
export const GenericErrorShowsProviderDetail: Story = {
|
||||
args: {
|
||||
...defaultArgs,
|
||||
|
||||
Reference in New Issue
Block a user