Skip to content

fix(api-client): Use ApiClientError for non-JSON 400 responses - #1269

Open
sentry[bot] wants to merge 1 commit into
mainfrom
seer/fix/mcp-server-g2e
Open

sentry[bot] wants to merge 1 commit into
mainfrom
seer/fix/mcp-server-g2e

Conversation

@sentry

@sentry sentry Bot commented Aug 26, 2026

Copy link
Copy Markdown
Contributor

Previously, SentryApiService.parseJsonResponse would throw a plain Error when it encountered a non-JSON response (e.g., HTML) for a 400 Bad Request. This plain Error was not recognized by isExpectedToolError as an expected API client error, causing it to be incorrectly logged as an unhandled exception in Sentry.

This change updates parseJsonResponse to use createApiError(...) instead of throw new Error(...) for both the HTML and generic non-JSON fallback paths. This ensures that these 400 responses are correctly classified as ApiClientError (specifically ApiValidationError), which isExpectedToolError will then suppress, preventing unnecessary Sentry alerts.

Fixes MCP-SERVER-G2E

Comment @sentry <feedback> on this PR to have Autofix iterate on the changes.

This PR was automatically generated by Sentry. You can adjust this setting at any time.

@sentry
sentry Bot marked this pull request as ready for review August 26, 2026 22:44
@sentry
sentry Bot requested a review from dcramer August 26, 2026 22:44
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.

0 participants