Skip to content

feat(api): Add getSentryApiErrorDetails for mapping SDK errors - #131249

Merged
BYK merged 1 commit into
masterfrom
feat/api-error-details
Nov 16, 2026
Merged

BYK merged 1 commit into
masterfrom
feat/api-error-details

Conversation

@sentry-junior

@sentry-junior sentry-junior Bot commented Nov 16, 2026

Copy link
Copy Markdown
Contributor

Part of #131203.

Apps that already have their own request error class (with responseJSON, responseText, status and a "METHOD /path status" message) can map SentryApiError to it in an error interceptor. Until now they had to pull those fields out of the error themselves.

getSentryApiErrorDetails(error, request?) collects them into plain data:

  • method and path, read from the error's request or the interceptor's
  • status and statusText
  • responseJSON, set only when the body was JSON
  • responseText
  • summary, for example GET /api/0/organizations/ 404

The SDK doesn't import or define the app's class. A new paragraph in the README's "Custom errors" section shows the recipe: a small RequestError class plus the interceptor that returns it. Nothing changes for clients that don't use the helper.

via @BYK.

--

View Session [Sentry]

Applications that keep their own request error class map SentryApiError
to it in an error interceptor. getSentryApiErrorDetails collects the
fields such a class usually carries (method, path, status, statusText,
the parsed JSON body, the response text) and a METHOD /path status
summary, so the mapping does not reparse the error. The README's Custom
errors section shows the recipe.

Co-Authored-By: BYK <[email protected]>
@sentry-junior
sentry-junior Bot requested review from a team as code owners November 16, 2026 14:16
@sentry-junior
sentry-junior Bot requested a review from BYK November 16, 2026 14:16
@github-actions github-actions Bot added the Scope: Frontend Automatically applied to PRs that change frontend components label Nov 16, 2026
@BYK
BYK enabled auto-merge (squash) November 16, 2026 14:18
@BYK
BYK merged commit 08b7701 into master Nov 16, 2026
88 checks passed
@BYK
BYK deleted the feat/api-error-details branch November 16, 2026 14:25

This branch was successfully deployed

1 active deployment
Preview — b73a40fe Deployed Nov 16, 2026 by vercel[bot]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Scope: Frontend Automatically applied to PRs that change frontend components

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant