Skip to content

Commit e3d75a0

Browse files
committed
fix: display actual API error message for 400+ errors instead of i18n strings
Show the actual error text from the API response as the main error message for HTTP 400+ errors, rather than using generic i18n translated strings. This provides users with specific, actionable error information directly.
1 parent 2f664e9 commit e3d75a0

File tree

1 file changed

+13
-31
lines changed

1 file changed

+13
-31
lines changed

webview-ui/src/components/chat/ChatRow.tsx

Lines changed: 13 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -162,7 +162,7 @@ export const ChatRowContent = ({
162162
onBatchFileResponse,
163163
isFollowUpAnswered,
164164
}: ChatRowContentProps) => {
165-
const { t, i18n } = useTranslation()
165+
const { t } = useTranslation()
166166

167167
const { mcpServers, alwaysAllowMcp, currentCheckpoint, mode, apiConfiguration, clineMessages } = useExtensionState()
168168
const { info: model } = useSelectedModel(apiConfiguration)
@@ -1110,45 +1110,27 @@ export const ChatRowContent = ({
11101110
)
11111111
case "api_req_retry_delayed":
11121112
let body = t(`chat:apiRequest.failed`)
1113-
let retryInfo, code, docsURL
1113+
let code, docsURL
11141114
if (message.text !== undefined) {
1115-
// Try to show richer error message for that code, if available
1115+
// Check if error message starts with an HTTP status code (400+)
11161116
const potentialCode = parseInt(message.text.substring(0, 3))
11171117
if (potentialCode >= 400) {
11181118
code = potentialCode
1119-
const stringForError = `chat:apiRequest.errorMessage.${code}`
1120-
if (i18n.exists(stringForError)) {
1121-
body = t(stringForError)
1122-
// Fill this out in upcoming PRs
1123-
// Do not remove this
1124-
// switch(code) {
1125-
// case ERROR_CODE:
1126-
// docsURL = ???
1127-
// break;
1128-
// }
1129-
} else {
1130-
body = t("chat:apiRequest.errorMessage.unknown")
1131-
docsURL = "mailto:[email protected]?subject=Unknown API Error"
1132-
}
1133-
retryInfo = (
1134-
<p className="mt-1 font-light text-xs text-vscode-errorForeground/80 cursor-default">
1135-
{message.text.substring(4)}
1136-
</p>
1137-
)
1119+
// Display the actual error message (after the status code prefix)
1120+
body = message.text.substring(4)
1121+
// Fill this out in upcoming PRs
1122+
// Do not remove this
1123+
// switch(code) {
1124+
// case ERROR_CODE:
1125+
// docsURL = ???
1126+
// break;
1127+
// }
11381128
} else {
11391129
// Non-HTTP-status-code error message - display the actual error text
11401130
body = message.text
11411131
}
11421132
}
1143-
return (
1144-
<ErrorRow
1145-
type="api_req_retry_delayed"
1146-
code={code}
1147-
message={body}
1148-
docsURL={docsURL}
1149-
additionalContent={retryInfo}
1150-
/>
1151-
)
1133+
return <ErrorRow type="api_req_retry_delayed" code={code} message={body} docsURL={docsURL} />
11521134
case "api_req_finished":
11531135
return null // we should never see this message type
11541136
case "text":

0 commit comments

Comments
 (0)