Skip to content

Commit 58f06f3

Browse files
themezclaude
andcommitted
fix: properly display API error response body for 400 errors
Previously, ApiError instances were being re-wrapped, causing the responseBody to be lost and showing nested error messages like "API Error: Error from OpenAI: Error: API Error: Status Code 400" instead of the actual error details. Now ApiError instances are passed through without re-wrapping, ensuring the responseBody is preserved and displayed correctly in MessageErrTips. 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <noreply@anthropic.com>
1 parent 3c04725 commit 58f06f3

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

src/shared/models/abstract-ai-sdk.ts

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -389,6 +389,9 @@ export default abstract class AbstractAISDKModel implements ModelInterface {
389389
if (APICallError.isInstance(error)) {
390390
throw new ApiError(`Error from ${this.name}${context}`, error.responseBody)
391391
}
392+
if (error instanceof ApiError) {
393+
throw error
394+
}
392395
if (error instanceof ChatboxAIAPIError) {
393396
throw error
394397
}

0 commit comments

Comments
 (0)