Skip to content

fix(error): preserve unwrapped API error bodies#1897

Open
vixco wants to merge 1 commit into
openai:masterfrom
vixco:fix/preserve-nonstandard-error-body
Open

fix(error): preserve unwrapped API error bodies#1897
vixco wants to merge 1 commit into
openai:masterfrom
vixco:fix/preserve-nonstandard-error-body

Conversation

@vixco
Copy link
Copy Markdown

@vixco vixco commented May 27, 2026

  • I understand that this repository is auto-generated and my pull request may not be merged

Changes being requested

Preserve JSON error response bodies that do not use the OpenAI { error: ... } wrapper. Today those responses produce an APIError with error === undefined even though the response body was valid JSON. This keeps the existing behavior for wrapped OpenAI errors, while falling back to the full parsed body when the error key is absent.

Additional context & links

Fixes #1577.

Tests:

  • ./node_modules/.bin/jest.cmd tests/index.test.ts
  • ./node_modules/.bin/eslint.cmd src/core/error.ts tests/index.test.ts

Note:
ode ./node_modules/typescript/bin/tsc currently fails in this local checkout because example files import optional packages that are not installed here (@azure/identity, express,
ext).

@vixco vixco requested a review from a team as a code owner May 27, 2026 09:47
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Support raw error responses

1 participant