Repository navigation
feat(api): Add getSentryApiErrorDetails for mapping SDK errors - #131249
Merged
Merged
Conversation
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]>
BYK
approved these changes
Nov 16, 2026
This branch was successfully deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Part of #131203.
Apps that already have their own request error class (with
responseJSON,responseText,statusand a"METHOD /path status"message) can mapSentryApiErrorto 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:methodandpath, read from the error's request or the interceptor'sstatusandstatusTextresponseJSON, set only when the body was JSONresponseTextsummary, for exampleGET /api/0/organizations/ 404The 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
RequestErrorclass plus the interceptor that returns it. Nothing changes for clients that don't use the helper.via @BYK.
--
View Session [Sentry]