sentry-javascript icon indicating copy to clipboard operation
sentry-javascript copied to clipboard

feat(core): Add option to enhance the fetch error message

Open JPeer264 opened this issue 2 weeks ago • 3 comments

(closes #18449) (closes JS-1281)

Problem

As of now, the user has no chance to disallow the manipulation of fetch errors, as we overwrite the error. This can cause problems as seen in #18449.

Solution

This adds a new option for the SDK (please be very critical about that new option here, since fetch has no integration this has to be added as a init option). always is the default and acts the same as it is now, so it is acting as feature:

enhanceFetchErrorMessages: 'always' | 'report-only' | false`

To give the user full control of how the errors are done there are 3 settings:

always report-only false
manipulate the error message directly
send only the changed message to Sentry

Special attention to reviewers

When having report-only the generated logs locally differ from the ones in Sentry. I am not quite sure if that would cause any problems. This is the only question which I don't have the answer to yet

JPeer264 avatar Dec 10 '25 16:12 JPeer264