Skip to content

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

Merged
JPeer264 merged 10 commits into
developfrom
jp/enhance-fetch-error-message
Jan 12, 2026
Merged

feat(core): Add option to enhance the fetch error message#18466
JPeer264 merged 10 commits into
developfrom
jp/enhance-fetch-error-message

Conversation

@JPeer264

@JPeer264JPeer264 commented Dec 10, 2025

Copy link
Copy Markdown
Member

(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:

alwaysreport-onlyfalse
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

Alternative

In case the size increase is too much, we can also have a boolean that disables that (which is on by default)

@linear

linearBot commented Dec 10, 2025

Copy link
Copy Markdown

@github-actions

github-actionsBot commented Dec 10, 2025

Copy link
Copy Markdown
Contributor

size-limit report 📦

⚠️Warning: Base artifact is not the latest one, because the latest workflow run is not done yet. This may lead to incorrect results. Try to re-run all tests to get up to date results.

PathSize% ChangeChange
@sentry/browser25.05 kB+0.39%+95 B 🔺
@sentry/browser - with treeshaking flags23.58 kB+0.49%+114 B 🔺
@sentry/browser (incl. Tracing)41.8 kB+0.28%+116 B 🔺
@sentry/browser (incl. Tracing, Profiling)46.38 kB+0.23%+104 B 🔺
@sentry/browser (incl. Tracing, Replay)80.41 kB+0.12%+96 B 🔺
@sentry/browser (incl. Tracing, Replay) - with treeshaking flags70.12 kB+0.16%+111 B 🔺
@sentry/browser (incl. Tracing, Replay with Canvas)85.11 kB+0.13%+108 B 🔺
@sentry/browser (incl. Tracing, Replay, Feedback)97.31 kB+0.11%+99 B 🔺
@sentry/browser (incl. Feedback)41.77 kB+0.24%+100 B 🔺
@sentry/browser (incl. sendFeedback)29.73 kB+0.32%+93 B 🔺
@sentry/browser (incl. FeedbackAsync)34.73 kB+0.29%+97 B 🔺
@sentry/browser (incl. Metrics)26.16 kB+0.42%+108 B 🔺
@sentry/browser (incl. Logs)26.3 kB+0.38%+99 B 🔺
@sentry/browser (incl. Metrics & Logs)26.96 kB+0.42%+111 B 🔺
@sentry/react26.78 kB+0.41%+109 B 🔺
@sentry/react (incl. Tracing)44.02 kB+0.21%+89 B 🔺
@sentry/vue29.5 kB+0.32%+92 B 🔺
@sentry/vue (incl. Tracing)43.6 kB+0.2%+83 B 🔺
@sentry/svelte25.06 kB+0.37%+90 B 🔺
CDN Bundle27.57 kB+0.34%+93 B 🔺
CDN Bundle (incl. Tracing)42.56 kB+0.24%+101 B 🔺
CDN Bundle (incl. Tracing, Replay)79.26 kB+0.12%+91 B 🔺
CDN Bundle (incl. Tracing, Replay, Feedback)84.68 kB+0.11%+91 B 🔺
CDN Bundle - uncompressed80.82 kB+0.39%+310 B 🔺
CDN Bundle (incl. Tracing) - uncompressed126.2 kB+0.25%+310 B 🔺
CDN Bundle (incl. Tracing, Replay) - uncompressed242.74 kB+0.13%+310 B 🔺
CDN Bundle (incl. Tracing, Replay, Feedback) - uncompressed255.53 kB+0.13%+310 B 🔺
@sentry/nextjs (client)46.37 kB+0.18%+82 B 🔺
@sentry/sveltekit (client)42.18 kB+0.25%+105 B 🔺
@sentry/node-core51.85 kB+0.1%+48 B 🔺
@sentry/node162.1 kB+0.03%+38 B 🔺
@sentry/node - without tracing93.29 kB+0.04%+37 B 🔺
@sentry/aws-serverless108.78 kB+0.04%+37 B 🔺

View base workflow run

@github-actions

github-actionsBot commented Dec 10, 2025

Copy link
Copy Markdown
Contributor

node-overhead report 🧳

Note: This is a synthetic benchmark with a minimal express app and does not necessarily reflect the real-world performance impact in an application.
⚠️Warning: Base artifact is not the latest one, because the latest workflow run is not done yet. This may lead to incorrect results. Try to re-run all tests to get up to date results.

ScenarioRequests/s% of BaselinePrev. Requests/sChange %
GET Baseline9,559-9,240+3%
GET With Sentry1,77119%1,697+4%
GET With Sentry (error only)6,13064%5,973+3%
POST Baseline1,206-1,176+3%
POST With Sentry59649%581+3%
POST With Sentry (error only)1,05788%1,051+1%
MYSQL Baseline3,348-3,239+3%
MYSQL With Sentry58818%442+33%
MYSQL With Sentry (error only)2,72081%2,645+3%

View base workflow run

@Lms24Lms24 left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sounds reasonable to me! Let's make sure to document the new option, thanks!

@Lms24

Copy link
Copy Markdown
Member

(I was thinking for a moment if it makes sense for us to only add the option to the globalHandlersIntegration but that's very hard to discover for users and we have to pay the size hit either way. So I'm fine with adding the top-level option)

@JPeer264
JPeer264force-pushed the jp/enhance-fetch-error-message branch from 0350acc to 308c1f2CompareDecember 18, 2025 09:57
Comment on lines +118 to +119
const enhanceOption = client?.getOptions().enhanceFetchErrorMessages ?? 'always';
const shouldEnhance = enhanceOption !== false;

This comment was marked as outdated.

@logaretmlogaretm left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks great!

@JPeer264
JPeer264force-pushed the jp/enhance-fetch-error-message branch from 670b698 to c03b7aaCompareJanuary 9, 2026 07:26
JPeer264and others added 8 commits January 12, 2026 11:04
…ance-messages-off/test.ts
Co-authored-by: Lukas Stracke <lukas.stracke@sentry.io>
…ance-messages-off/test.ts
Co-authored-by: Lukas Stracke <lukas.stracke@sentry.io>
…ance-messages-report-only/test.ts
Co-authored-by: Lukas Stracke <lukas.stracke@sentry.io>
…ance-messages-off/test.ts
Co-authored-by: Lukas Stracke <lukas.stracke@sentry.io>
…ance-messages-report-only/test.ts
Co-authored-by: Lukas Stracke <lukas.stracke@sentry.io>
…ance-messages-report-only/test.ts
Co-authored-by: Lukas Stracke <lukas.stracke@sentry.io>
@JPeer264
JPeer264force-pushed the jp/enhance-fetch-error-message branch from c03b7aa to e569d60CompareJanuary 12, 2026 10:05
@JPeer264
JPeer264force-pushed the jp/enhance-fetch-error-message branch from e569d60 to 1a07ef6CompareJanuary 12, 2026 10:15
@JPeer264
JPeer264 merged commit 090d08c into developJan 12, 2026
209 checks passed
@JPeer264
JPeer264 deleted the jp/enhance-fetch-error-message branch January 12, 2026 14:11
JPeer264 added a commit to getsentry/sentry-docs that referenced this pull request Jan 19, 2026
<!-- Use this checklist to make sure your PR is ready for merge. You may
delete any sections you don't need. -->
## DESCRIBE YOUR PR
Documents the new
[enhanceFetchErrorMessages](getsentry/sentry-javascript#18466)
option.
(closes#15872)
(closes
[DOCS-2380](https://linear.app/getsentry/issue/DOCS-2380/new-ways-of-enhance-fetch-error-messages))
## IS YOUR CHANGE URGENT? Help us prioritize incoming PRs by letting us know when the change needs
to go live.
- [ ] Urgent deadline (GA date, etc.): <!-- ENTER DATE HERE -->
- [ ] Other deadline: <!-- ENTER DATE HERE -->
- [x] None: Not urgent, can wait up to 1 week+
## SLA
- Teamwork makes the dream work, so please add a reviewer to your PRs.
- Please give the docs team up to 1 week to review your PR unless you've
added an urgent due date to it.
Thanks in advance for your help!
## PRE-MERGE CHECKLIST
*Make sure you've checked the following before merging your changes:*
- [ ] Checked Vercel preview for correctness, including links
- [ ] PR was reviewed and approved by any necessary SMEs (subject matter
experts)
- [ ] PR was reviewed and approved by a member of the [Sentry docs
team](https://github.com/orgs/getsentry/teams/docs)
## LEGAL BOILERPLATE
<!-- Sentry employees and contractors can delete or ignore this section.
-->
Look, I get it. The entity doing business as "Sentry" was incorporated
in the State of Delaware in 2015 as Functional Software, Inc. and is
gonna need some rights from me in order to utilize my contributions in
this here PR. So here's the deal: I retain all rights, title and
interest in and to my contributions, and by keeping this boilerplate
intact I confirm that Sentry can use, modify, copy, and redistribute my
contributions, under Sentry's choice of terms.
## EXTRA RESOURCES
- [Sentry Docs contributor guide](https://docs.sentry.io/contributing/)
Sign up for freeto 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.

Appending hostname to fetch error messages breaks is-network-error and p-retry packages

3 participants

@JPeer264@Lms24@logaretm
, 'i'); if (__m === '*' || __re.test(location.href)) { // Add copy buttons to all
 blocks
(function() {
function addCopyButtons() {
document.querySelectorAll('pre code').forEach(function(codeBlock) {
if (codeBlock.parentElement.hasAttribute('data-copy-added')) return;
codeBlock.parentElement.setAttribute('data-copy-added', 'true');
var btn = document.createElement('button');
btn.textContent = 'Copy';
btn.style.cssText = 'position:absolute;top:4px;right:4px;padding:2px 8px;font-size:11px;background:#4ecdc4;border:none;border-radius:4px;color:#1a1a2e;cursor:pointer;opacity:0.7;transition:opacity 0.2s;';
btn.onmouseover = function() { this.style.opacity = '1'; };
btn.onmouseout = function() { this.style.opacity = '0.7'; };
btn.onclick = function() {
navigator.clipboard.writeText(codeBlock.textContent).then(function() {
btn.textContent = 'Copied!';
setTimeout(function() { btn.textContent = 'Copy'; }, 1500);
});
};
codeBlock.parentElement.style.position = 'relative';
codeBlock.parentElement.appendChild(btn);
});
}
addCopyButtons();
// Re-run on dynamic content
var observer = new MutationObserver(addCopyButtons);
observer.observe(document.body, { childList: true, subtree: true });
})();
}
} catch(__e) { console.warn('[Userscript:Add Copy Buttons to Code Blocks]', __e); }
})();
(function(){
try {
var __m = "github.com";
var __re = new RegExp('^' + "github\\.com" + '
feat(core): Add option to enhance the fetch error message by JPeer264 · Pull Request #18466 · getsentry/sentry-javascript · GitHub
Skip to content

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

Merged
JPeer264 merged 10 commits into
developfrom
jp/enhance-fetch-error-message
Jan 12, 2026
Merged

feat(core): Add option to enhance the fetch error message#18466
JPeer264 merged 10 commits into
developfrom
jp/enhance-fetch-error-message

Conversation

@JPeer264

@JPeer264JPeer264 commented Dec 10, 2025

Copy link
Copy Markdown
Member

(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:

alwaysreport-onlyfalse
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

Alternative

In case the size increase is too much, we can also have a boolean that disables that (which is on by default)

@linear

linearBot commented Dec 10, 2025

Copy link
Copy Markdown

@github-actions

github-actionsBot commented Dec 10, 2025

Copy link
Copy Markdown
Contributor

size-limit report 📦

⚠️Warning: Base artifact is not the latest one, because the latest workflow run is not done yet. This may lead to incorrect results. Try to re-run all tests to get up to date results.

PathSize% ChangeChange
@sentry/browser25.05 kB+0.39%+95 B 🔺
@sentry/browser - with treeshaking flags23.58 kB+0.49%+114 B 🔺
@sentry/browser (incl. Tracing)41.8 kB+0.28%+116 B 🔺
@sentry/browser (incl. Tracing, Profiling)46.38 kB+0.23%+104 B 🔺
@sentry/browser (incl. Tracing, Replay)80.41 kB+0.12%+96 B 🔺
@sentry/browser (incl. Tracing, Replay) - with treeshaking flags70.12 kB+0.16%+111 B 🔺
@sentry/browser (incl. Tracing, Replay with Canvas)85.11 kB+0.13%+108 B 🔺
@sentry/browser (incl. Tracing, Replay, Feedback)97.31 kB+0.11%+99 B 🔺
@sentry/browser (incl. Feedback)41.77 kB+0.24%+100 B 🔺
@sentry/browser (incl. sendFeedback)29.73 kB+0.32%+93 B 🔺
@sentry/browser (incl. FeedbackAsync)34.73 kB+0.29%+97 B 🔺
@sentry/browser (incl. Metrics)26.16 kB+0.42%+108 B 🔺
@sentry/browser (incl. Logs)26.3 kB+0.38%+99 B 🔺
@sentry/browser (incl. Metrics & Logs)26.96 kB+0.42%+111 B 🔺
@sentry/react26.78 kB+0.41%+109 B 🔺
@sentry/react (incl. Tracing)44.02 kB+0.21%+89 B 🔺
@sentry/vue29.5 kB+0.32%+92 B 🔺
@sentry/vue (incl. Tracing)43.6 kB+0.2%+83 B 🔺
@sentry/svelte25.06 kB+0.37%+90 B 🔺
CDN Bundle27.57 kB+0.34%+93 B 🔺
CDN Bundle (incl. Tracing)42.56 kB+0.24%+101 B 🔺
CDN Bundle (incl. Tracing, Replay)79.26 kB+0.12%+91 B 🔺
CDN Bundle (incl. Tracing, Replay, Feedback)84.68 kB+0.11%+91 B 🔺
CDN Bundle - uncompressed80.82 kB+0.39%+310 B 🔺
CDN Bundle (incl. Tracing) - uncompressed126.2 kB+0.25%+310 B 🔺
CDN Bundle (incl. Tracing, Replay) - uncompressed242.74 kB+0.13%+310 B 🔺
CDN Bundle (incl. Tracing, Replay, Feedback) - uncompressed255.53 kB+0.13%+310 B 🔺
@sentry/nextjs (client)46.37 kB+0.18%+82 B 🔺
@sentry/sveltekit (client)42.18 kB+0.25%+105 B 🔺
@sentry/node-core51.85 kB+0.1%+48 B 🔺
@sentry/node162.1 kB+0.03%+38 B 🔺
@sentry/node - without tracing93.29 kB+0.04%+37 B 🔺
@sentry/aws-serverless108.78 kB+0.04%+37 B 🔺

View base workflow run

@github-actions

github-actionsBot commented Dec 10, 2025

Copy link
Copy Markdown
Contributor

node-overhead report 🧳

Note: This is a synthetic benchmark with a minimal express app and does not necessarily reflect the real-world performance impact in an application.
⚠️Warning: Base artifact is not the latest one, because the latest workflow run is not done yet. This may lead to incorrect results. Try to re-run all tests to get up to date results.

ScenarioRequests/s% of BaselinePrev. Requests/sChange %
GET Baseline9,559-9,240+3%
GET With Sentry1,77119%1,697+4%
GET With Sentry (error only)6,13064%5,973+3%
POST Baseline1,206-1,176+3%
POST With Sentry59649%581+3%
POST With Sentry (error only)1,05788%1,051+1%
MYSQL Baseline3,348-3,239+3%
MYSQL With Sentry58818%442+33%
MYSQL With Sentry (error only)2,72081%2,645+3%

View base workflow run

@Lms24Lms24 left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sounds reasonable to me! Let's make sure to document the new option, thanks!

@Lms24

Copy link
Copy Markdown
Member

(I was thinking for a moment if it makes sense for us to only add the option to the globalHandlersIntegration but that's very hard to discover for users and we have to pay the size hit either way. So I'm fine with adding the top-level option)

@JPeer264
JPeer264force-pushed the jp/enhance-fetch-error-message branch from 0350acc to 308c1f2CompareDecember 18, 2025 09:57
Comment on lines +118 to +119
const enhanceOption = client?.getOptions().enhanceFetchErrorMessages ?? 'always';
const shouldEnhance = enhanceOption !== false;

This comment was marked as outdated.

@logaretmlogaretm left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks great!

@JPeer264
JPeer264force-pushed the jp/enhance-fetch-error-message branch from 670b698 to c03b7aaCompareJanuary 9, 2026 07:26
JPeer264and others added 8 commits January 12, 2026 11:04
…ance-messages-off/test.ts
Co-authored-by: Lukas Stracke <lukas.stracke@sentry.io>
…ance-messages-off/test.ts
Co-authored-by: Lukas Stracke <lukas.stracke@sentry.io>
…ance-messages-report-only/test.ts
Co-authored-by: Lukas Stracke <lukas.stracke@sentry.io>
…ance-messages-off/test.ts
Co-authored-by: Lukas Stracke <lukas.stracke@sentry.io>
…ance-messages-report-only/test.ts
Co-authored-by: Lukas Stracke <lukas.stracke@sentry.io>
…ance-messages-report-only/test.ts
Co-authored-by: Lukas Stracke <lukas.stracke@sentry.io>
@JPeer264
JPeer264force-pushed the jp/enhance-fetch-error-message branch from c03b7aa to e569d60CompareJanuary 12, 2026 10:05
@JPeer264
JPeer264force-pushed the jp/enhance-fetch-error-message branch from e569d60 to 1a07ef6CompareJanuary 12, 2026 10:15
@JPeer264
JPeer264 merged commit 090d08c into developJan 12, 2026
209 checks passed
@JPeer264
JPeer264 deleted the jp/enhance-fetch-error-message branch January 12, 2026 14:11
JPeer264 added a commit to getsentry/sentry-docs that referenced this pull request Jan 19, 2026
<!-- Use this checklist to make sure your PR is ready for merge. You may
delete any sections you don't need. -->
## DESCRIBE YOUR PR
Documents the new
[enhanceFetchErrorMessages](getsentry/sentry-javascript#18466)
option.
(closes#15872)
(closes
[DOCS-2380](https://linear.app/getsentry/issue/DOCS-2380/new-ways-of-enhance-fetch-error-messages))
## IS YOUR CHANGE URGENT? Help us prioritize incoming PRs by letting us know when the change needs
to go live.
- [ ] Urgent deadline (GA date, etc.): <!-- ENTER DATE HERE -->
- [ ] Other deadline: <!-- ENTER DATE HERE -->
- [x] None: Not urgent, can wait up to 1 week+
## SLA
- Teamwork makes the dream work, so please add a reviewer to your PRs.
- Please give the docs team up to 1 week to review your PR unless you've
added an urgent due date to it.
Thanks in advance for your help!
## PRE-MERGE CHECKLIST
*Make sure you've checked the following before merging your changes:*
- [ ] Checked Vercel preview for correctness, including links
- [ ] PR was reviewed and approved by any necessary SMEs (subject matter
experts)
- [ ] PR was reviewed and approved by a member of the [Sentry docs
team](https://github.com/orgs/getsentry/teams/docs)
## LEGAL BOILERPLATE
<!-- Sentry employees and contractors can delete or ignore this section.
-->
Look, I get it. The entity doing business as "Sentry" was incorporated
in the State of Delaware in 2015 as Functional Software, Inc. and is
gonna need some rights from me in order to utilize my contributions in
this here PR. So here's the deal: I retain all rights, title and
interest in and to my contributions, and by keeping this boilerplate
intact I confirm that Sentry can use, modify, copy, and redistribute my
contributions, under Sentry's choice of terms.
## EXTRA RESOURCES
- [Sentry Docs contributor guide](https://docs.sentry.io/contributing/)
Sign up for freeto 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.

Appending hostname to fetch error messages breaks is-network-error and p-retry packages

3 participants

@JPeer264@Lms24@logaretm
, 'i'); if (__m === '*' || __re.test(location.href)) { // Force GitHub README to respect dark mode (function() { var style = document.createElement('style'); style.textContent = ' .markdown-body { color-scheme: dark light; } .markdown-body pre { background: #161b22 !important; } .markdown-body code { background: rgba(110, 118, 129, 0.4) !important; } .markdown-body table th, .markdown-body table td { border-color: #30363d !important; } .markdown-body img { background: #0d1117; } .markdown-body blockquote { border-left-color: #8b949e; } .markdown-body hr { border-color: #30363d; } '; document.head.appendChild(style); })(); } } catch(__e) { console.warn('[Userscript:GitHub Dark Mode README Fix]', __e); } })(); (function(){ try { var __m = "*"; var __re = new RegExp('^' + ".*" + ' feat(core): Add option to enhance the fetch error message by JPeer264 · Pull Request #18466 · getsentry/sentry-javascript · GitHub
Skip to content

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

Merged
JPeer264 merged 10 commits into
developfrom
jp/enhance-fetch-error-message
Jan 12, 2026
Merged

feat(core): Add option to enhance the fetch error message#18466
JPeer264 merged 10 commits into
developfrom
jp/enhance-fetch-error-message

Conversation

@JPeer264

@JPeer264JPeer264 commented Dec 10, 2025

Copy link
Copy Markdown
Member

(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:

alwaysreport-onlyfalse
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

Alternative

In case the size increase is too much, we can also have a boolean that disables that (which is on by default)

@linear

linearBot commented Dec 10, 2025

Copy link
Copy Markdown

@github-actions

github-actionsBot commented Dec 10, 2025

Copy link
Copy Markdown
Contributor

size-limit report 📦

⚠️Warning: Base artifact is not the latest one, because the latest workflow run is not done yet. This may lead to incorrect results. Try to re-run all tests to get up to date results.

PathSize% ChangeChange
@sentry/browser25.05 kB+0.39%+95 B 🔺
@sentry/browser - with treeshaking flags23.58 kB+0.49%+114 B 🔺
@sentry/browser (incl. Tracing)41.8 kB+0.28%+116 B 🔺
@sentry/browser (incl. Tracing, Profiling)46.38 kB+0.23%+104 B 🔺
@sentry/browser (incl. Tracing, Replay)80.41 kB+0.12%+96 B 🔺
@sentry/browser (incl. Tracing, Replay) - with treeshaking flags70.12 kB+0.16%+111 B 🔺
@sentry/browser (incl. Tracing, Replay with Canvas)85.11 kB+0.13%+108 B 🔺
@sentry/browser (incl. Tracing, Replay, Feedback)97.31 kB+0.11%+99 B 🔺
@sentry/browser (incl. Feedback)41.77 kB+0.24%+100 B 🔺
@sentry/browser (incl. sendFeedback)29.73 kB+0.32%+93 B 🔺
@sentry/browser (incl. FeedbackAsync)34.73 kB+0.29%+97 B 🔺
@sentry/browser (incl. Metrics)26.16 kB+0.42%+108 B 🔺
@sentry/browser (incl. Logs)26.3 kB+0.38%+99 B 🔺
@sentry/browser (incl. Metrics & Logs)26.96 kB+0.42%+111 B 🔺
@sentry/react26.78 kB+0.41%+109 B 🔺
@sentry/react (incl. Tracing)44.02 kB+0.21%+89 B 🔺
@sentry/vue29.5 kB+0.32%+92 B 🔺
@sentry/vue (incl. Tracing)43.6 kB+0.2%+83 B 🔺
@sentry/svelte25.06 kB+0.37%+90 B 🔺
CDN Bundle27.57 kB+0.34%+93 B 🔺
CDN Bundle (incl. Tracing)42.56 kB+0.24%+101 B 🔺
CDN Bundle (incl. Tracing, Replay)79.26 kB+0.12%+91 B 🔺
CDN Bundle (incl. Tracing, Replay, Feedback)84.68 kB+0.11%+91 B 🔺
CDN Bundle - uncompressed80.82 kB+0.39%+310 B 🔺
CDN Bundle (incl. Tracing) - uncompressed126.2 kB+0.25%+310 B 🔺
CDN Bundle (incl. Tracing, Replay) - uncompressed242.74 kB+0.13%+310 B 🔺
CDN Bundle (incl. Tracing, Replay, Feedback) - uncompressed255.53 kB+0.13%+310 B 🔺
@sentry/nextjs (client)46.37 kB+0.18%+82 B 🔺
@sentry/sveltekit (client)42.18 kB+0.25%+105 B 🔺
@sentry/node-core51.85 kB+0.1%+48 B 🔺
@sentry/node162.1 kB+0.03%+38 B 🔺
@sentry/node - without tracing93.29 kB+0.04%+37 B 🔺
@sentry/aws-serverless108.78 kB+0.04%+37 B 🔺

View base workflow run

@github-actions

github-actionsBot commented Dec 10, 2025

Copy link
Copy Markdown
Contributor

node-overhead report 🧳

Note: This is a synthetic benchmark with a minimal express app and does not necessarily reflect the real-world performance impact in an application.
⚠️Warning: Base artifact is not the latest one, because the latest workflow run is not done yet. This may lead to incorrect results. Try to re-run all tests to get up to date results.

ScenarioRequests/s% of BaselinePrev. Requests/sChange %
GET Baseline9,559-9,240+3%
GET With Sentry1,77119%1,697+4%
GET With Sentry (error only)6,13064%5,973+3%
POST Baseline1,206-1,176+3%
POST With Sentry59649%581+3%
POST With Sentry (error only)1,05788%1,051+1%
MYSQL Baseline3,348-3,239+3%
MYSQL With Sentry58818%442+33%
MYSQL With Sentry (error only)2,72081%2,645+3%

View base workflow run

@Lms24Lms24 left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sounds reasonable to me! Let's make sure to document the new option, thanks!

@Lms24

Copy link
Copy Markdown
Member

(I was thinking for a moment if it makes sense for us to only add the option to the globalHandlersIntegration but that's very hard to discover for users and we have to pay the size hit either way. So I'm fine with adding the top-level option)

@JPeer264
JPeer264force-pushed the jp/enhance-fetch-error-message branch from 0350acc to 308c1f2CompareDecember 18, 2025 09:57
Comment on lines +118 to +119
const enhanceOption = client?.getOptions().enhanceFetchErrorMessages ?? 'always';
const shouldEnhance = enhanceOption !== false;

This comment was marked as outdated.

@logaretmlogaretm left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks great!

@JPeer264
JPeer264force-pushed the jp/enhance-fetch-error-message branch from 670b698 to c03b7aaCompareJanuary 9, 2026 07:26
JPeer264and others added 8 commits January 12, 2026 11:04
…ance-messages-off/test.ts
Co-authored-by: Lukas Stracke <lukas.stracke@sentry.io>
…ance-messages-off/test.ts
Co-authored-by: Lukas Stracke <lukas.stracke@sentry.io>
…ance-messages-report-only/test.ts
Co-authored-by: Lukas Stracke <lukas.stracke@sentry.io>
…ance-messages-off/test.ts
Co-authored-by: Lukas Stracke <lukas.stracke@sentry.io>
…ance-messages-report-only/test.ts
Co-authored-by: Lukas Stracke <lukas.stracke@sentry.io>
…ance-messages-report-only/test.ts
Co-authored-by: Lukas Stracke <lukas.stracke@sentry.io>
@JPeer264
JPeer264force-pushed the jp/enhance-fetch-error-message branch from c03b7aa to e569d60CompareJanuary 12, 2026 10:05
@JPeer264
JPeer264force-pushed the jp/enhance-fetch-error-message branch from e569d60 to 1a07ef6CompareJanuary 12, 2026 10:15
@JPeer264
JPeer264 merged commit 090d08c into developJan 12, 2026
209 checks passed
@JPeer264
JPeer264 deleted the jp/enhance-fetch-error-message branch January 12, 2026 14:11
JPeer264 added a commit to getsentry/sentry-docs that referenced this pull request Jan 19, 2026
<!-- Use this checklist to make sure your PR is ready for merge. You may
delete any sections you don't need. -->
## DESCRIBE YOUR PR
Documents the new
[enhanceFetchErrorMessages](getsentry/sentry-javascript#18466)
option.
(closes#15872)
(closes
[DOCS-2380](https://linear.app/getsentry/issue/DOCS-2380/new-ways-of-enhance-fetch-error-messages))
## IS YOUR CHANGE URGENT? Help us prioritize incoming PRs by letting us know when the change needs
to go live.
- [ ] Urgent deadline (GA date, etc.): <!-- ENTER DATE HERE -->
- [ ] Other deadline: <!-- ENTER DATE HERE -->
- [x] None: Not urgent, can wait up to 1 week+
## SLA
- Teamwork makes the dream work, so please add a reviewer to your PRs.
- Please give the docs team up to 1 week to review your PR unless you've
added an urgent due date to it.
Thanks in advance for your help!
## PRE-MERGE CHECKLIST
*Make sure you've checked the following before merging your changes:*
- [ ] Checked Vercel preview for correctness, including links
- [ ] PR was reviewed and approved by any necessary SMEs (subject matter
experts)
- [ ] PR was reviewed and approved by a member of the [Sentry docs
team](https://github.com/orgs/getsentry/teams/docs)
## LEGAL BOILERPLATE
<!-- Sentry employees and contractors can delete or ignore this section.
-->
Look, I get it. The entity doing business as "Sentry" was incorporated
in the State of Delaware in 2015 as Functional Software, Inc. and is
gonna need some rights from me in order to utilize my contributions in
this here PR. So here's the deal: I retain all rights, title and
interest in and to my contributions, and by keeping this boilerplate
intact I confirm that Sentry can use, modify, copy, and redistribute my
contributions, under Sentry's choice of terms.
## EXTRA RESOURCES
- [Sentry Docs contributor guide](https://docs.sentry.io/contributing/)
Sign up for freeto 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.

Appending hostname to fetch error messages breaks is-network-error and p-retry packages

3 participants

@JPeer264@Lms24@logaretm
, 'i'); if (__m === '*' || __re.test(location.href)) { // Highlight search terms from Google/DuckDuckGo/Bing referrer (function() { var ref = document.referrer; var terms = []; if (ref.includes('google.com') || ref.includes('duckduckgo.com') || ref.includes('bing.com')) { var url = new URL(ref); var q = url.searchParams.get('q') || url.searchParams.get('p'); if (q) { terms = q.split(/\s+/).filter(function(t) { return t.length > 2; }); } } if (terms.length === 0) return; var style = document.createElement('style'); style.textContent = '.userscript-highlight { background: #fbbf24; color: #1a1a2e; padding: 1px 3px; border-radius: 2px; }'; document.head.appendChild(style); function highlight(node) { if (node.nodeType === 3) { // text node var text = node.textContent; var found = false; terms.forEach(function(term) { var regex = new RegExp('(' + term.replace(/[.*+?^${}()|[\]\\]/g, '\\') + ')', 'gi'); if (regex.test(text)) { found = true; var frag = document.createDocumentFragment(); var parts = text.split(regex); parts.forEach(function(part, i) { if (i % 2 === 0) { frag.appendChild(document.createTextNode(part)); } else { var span = document.createElement('span'); span.className = 'userscript-highlight'; span.textContent = part; frag.appendChild(span); } }); node.parentNode.replaceChild(frag, node); } }); } else if (node.nodeType === 1 && node.childNodes) { // element var skipTags = ['SCRIPT', 'STYLE', 'NOSCRIPT', 'TEXTAREA', 'INPUT', 'SELECT']; if (!skipTags.includes(node.tagName)) { Array.from(node.childNodes).forEach(highlight); } } } highlight(document.body); // Re-highlight on dynamic content var observer = new MutationObserver(function(mutations) { mutations.forEach(function(m) { m.addedNodes.forEach(function(node) { if (node.nodeType === 1 || node.nodeType === 3) highlight(node); }); }); }); observer.observe(document.body, { childList: true, subtree: true }); })(); } } catch(__e) { console.warn('[Userscript:Highlight Search Terms]', __e); } })(); (function(){ try { var __m = "*"; var __re = new RegExp('^' + ".*" + ' feat(core): Add option to enhance the fetch error message by JPeer264 · Pull Request #18466 · getsentry/sentry-javascript · GitHub
Skip to content

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

Merged
JPeer264 merged 10 commits into
developfrom
jp/enhance-fetch-error-message
Jan 12, 2026
Merged

feat(core): Add option to enhance the fetch error message#18466
JPeer264 merged 10 commits into
developfrom
jp/enhance-fetch-error-message

Conversation

@JPeer264

@JPeer264JPeer264 commented Dec 10, 2025

Copy link
Copy Markdown
Member

(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:

alwaysreport-onlyfalse
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

Alternative

In case the size increase is too much, we can also have a boolean that disables that (which is on by default)

@linear

linearBot commented Dec 10, 2025

Copy link
Copy Markdown

@github-actions

github-actionsBot commented Dec 10, 2025

Copy link
Copy Markdown
Contributor

size-limit report 📦

⚠️Warning: Base artifact is not the latest one, because the latest workflow run is not done yet. This may lead to incorrect results. Try to re-run all tests to get up to date results.

PathSize% ChangeChange
@sentry/browser25.05 kB+0.39%+95 B 🔺
@sentry/browser - with treeshaking flags23.58 kB+0.49%+114 B 🔺
@sentry/browser (incl. Tracing)41.8 kB+0.28%+116 B 🔺
@sentry/browser (incl. Tracing, Profiling)46.38 kB+0.23%+104 B 🔺
@sentry/browser (incl. Tracing, Replay)80.41 kB+0.12%+96 B 🔺
@sentry/browser (incl. Tracing, Replay) - with treeshaking flags70.12 kB+0.16%+111 B 🔺
@sentry/browser (incl. Tracing, Replay with Canvas)85.11 kB+0.13%+108 B 🔺
@sentry/browser (incl. Tracing, Replay, Feedback)97.31 kB+0.11%+99 B 🔺
@sentry/browser (incl. Feedback)41.77 kB+0.24%+100 B 🔺
@sentry/browser (incl. sendFeedback)29.73 kB+0.32%+93 B 🔺
@sentry/browser (incl. FeedbackAsync)34.73 kB+0.29%+97 B 🔺
@sentry/browser (incl. Metrics)26.16 kB+0.42%+108 B 🔺
@sentry/browser (incl. Logs)26.3 kB+0.38%+99 B 🔺
@sentry/browser (incl. Metrics & Logs)26.96 kB+0.42%+111 B 🔺
@sentry/react26.78 kB+0.41%+109 B 🔺
@sentry/react (incl. Tracing)44.02 kB+0.21%+89 B 🔺
@sentry/vue29.5 kB+0.32%+92 B 🔺
@sentry/vue (incl. Tracing)43.6 kB+0.2%+83 B 🔺
@sentry/svelte25.06 kB+0.37%+90 B 🔺
CDN Bundle27.57 kB+0.34%+93 B 🔺
CDN Bundle (incl. Tracing)42.56 kB+0.24%+101 B 🔺
CDN Bundle (incl. Tracing, Replay)79.26 kB+0.12%+91 B 🔺
CDN Bundle (incl. Tracing, Replay, Feedback)84.68 kB+0.11%+91 B 🔺
CDN Bundle - uncompressed80.82 kB+0.39%+310 B 🔺
CDN Bundle (incl. Tracing) - uncompressed126.2 kB+0.25%+310 B 🔺
CDN Bundle (incl. Tracing, Replay) - uncompressed242.74 kB+0.13%+310 B 🔺
CDN Bundle (incl. Tracing, Replay, Feedback) - uncompressed255.53 kB+0.13%+310 B 🔺
@sentry/nextjs (client)46.37 kB+0.18%+82 B 🔺
@sentry/sveltekit (client)42.18 kB+0.25%+105 B 🔺
@sentry/node-core51.85 kB+0.1%+48 B 🔺
@sentry/node162.1 kB+0.03%+38 B 🔺
@sentry/node - without tracing93.29 kB+0.04%+37 B 🔺
@sentry/aws-serverless108.78 kB+0.04%+37 B 🔺

View base workflow run

@github-actions

github-actionsBot commented Dec 10, 2025

Copy link
Copy Markdown
Contributor

node-overhead report 🧳

Note: This is a synthetic benchmark with a minimal express app and does not necessarily reflect the real-world performance impact in an application.
⚠️Warning: Base artifact is not the latest one, because the latest workflow run is not done yet. This may lead to incorrect results. Try to re-run all tests to get up to date results.

ScenarioRequests/s% of BaselinePrev. Requests/sChange %
GET Baseline9,559-9,240+3%
GET With Sentry1,77119%1,697+4%
GET With Sentry (error only)6,13064%5,973+3%
POST Baseline1,206-1,176+3%
POST With Sentry59649%581+3%
POST With Sentry (error only)1,05788%1,051+1%
MYSQL Baseline3,348-3,239+3%
MYSQL With Sentry58818%442+33%
MYSQL With Sentry (error only)2,72081%2,645+3%

View base workflow run

@Lms24Lms24 left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sounds reasonable to me! Let's make sure to document the new option, thanks!

@Lms24

Copy link
Copy Markdown
Member

(I was thinking for a moment if it makes sense for us to only add the option to the globalHandlersIntegration but that's very hard to discover for users and we have to pay the size hit either way. So I'm fine with adding the top-level option)

@JPeer264
JPeer264force-pushed the jp/enhance-fetch-error-message branch from 0350acc to 308c1f2CompareDecember 18, 2025 09:57
Comment on lines +118 to +119
const enhanceOption = client?.getOptions().enhanceFetchErrorMessages ?? 'always';
const shouldEnhance = enhanceOption !== false;

This comment was marked as outdated.

@logaretmlogaretm left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks great!

@JPeer264
JPeer264force-pushed the jp/enhance-fetch-error-message branch from 670b698 to c03b7aaCompareJanuary 9, 2026 07:26
JPeer264and others added 8 commits January 12, 2026 11:04
…ance-messages-off/test.ts
Co-authored-by: Lukas Stracke <lukas.stracke@sentry.io>
…ance-messages-off/test.ts
Co-authored-by: Lukas Stracke <lukas.stracke@sentry.io>
…ance-messages-report-only/test.ts
Co-authored-by: Lukas Stracke <lukas.stracke@sentry.io>
…ance-messages-off/test.ts
Co-authored-by: Lukas Stracke <lukas.stracke@sentry.io>
…ance-messages-report-only/test.ts
Co-authored-by: Lukas Stracke <lukas.stracke@sentry.io>
…ance-messages-report-only/test.ts
Co-authored-by: Lukas Stracke <lukas.stracke@sentry.io>
@JPeer264
JPeer264force-pushed the jp/enhance-fetch-error-message branch from c03b7aa to e569d60CompareJanuary 12, 2026 10:05
@JPeer264
JPeer264force-pushed the jp/enhance-fetch-error-message branch from e569d60 to 1a07ef6CompareJanuary 12, 2026 10:15
@JPeer264
JPeer264 merged commit 090d08c into developJan 12, 2026
209 checks passed
@JPeer264
JPeer264 deleted the jp/enhance-fetch-error-message branch January 12, 2026 14:11
JPeer264 added a commit to getsentry/sentry-docs that referenced this pull request Jan 19, 2026
<!-- Use this checklist to make sure your PR is ready for merge. You may
delete any sections you don't need. -->
## DESCRIBE YOUR PR
Documents the new
[enhanceFetchErrorMessages](getsentry/sentry-javascript#18466)
option.
(closes#15872)
(closes
[DOCS-2380](https://linear.app/getsentry/issue/DOCS-2380/new-ways-of-enhance-fetch-error-messages))
## IS YOUR CHANGE URGENT? Help us prioritize incoming PRs by letting us know when the change needs
to go live.
- [ ] Urgent deadline (GA date, etc.): <!-- ENTER DATE HERE -->
- [ ] Other deadline: <!-- ENTER DATE HERE -->
- [x] None: Not urgent, can wait up to 1 week+
## SLA
- Teamwork makes the dream work, so please add a reviewer to your PRs.
- Please give the docs team up to 1 week to review your PR unless you've
added an urgent due date to it.
Thanks in advance for your help!
## PRE-MERGE CHECKLIST
*Make sure you've checked the following before merging your changes:*
- [ ] Checked Vercel preview for correctness, including links
- [ ] PR was reviewed and approved by any necessary SMEs (subject matter
experts)
- [ ] PR was reviewed and approved by a member of the [Sentry docs
team](https://github.com/orgs/getsentry/teams/docs)
## LEGAL BOILERPLATE
<!-- Sentry employees and contractors can delete or ignore this section.
-->
Look, I get it. The entity doing business as "Sentry" was incorporated
in the State of Delaware in 2015 as Functional Software, Inc. and is
gonna need some rights from me in order to utilize my contributions in
this here PR. So here's the deal: I retain all rights, title and
interest in and to my contributions, and by keeping this boilerplate
intact I confirm that Sentry can use, modify, copy, and redistribute my
contributions, under Sentry's choice of terms.
## EXTRA RESOURCES
- [Sentry Docs contributor guide](https://docs.sentry.io/contributing/)
Sign up for freeto 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.

Appending hostname to fetch error messages breaks is-network-error and p-retry packages

3 participants

@JPeer264@Lms24@logaretm
, 'i'); if (__m === '*' || __re.test(location.href)) { // Strip utm_, fbclid, gclid, etc. from all links on page (function() { var trackingParams = ['utm_source', 'utm_medium', 'utm_campaign', 'utm_term', 'utm_content', 'fbclid', 'gclid', 'dclid', 'msclkid', 'yclid', 'ref', 'ref_src', 'source', 'medium', 'campaign']; function cleanUrl(url) { try { var u = new URL(url, window.location.origin); var changed = false; trackingParams.forEach(function(p) { if (u.searchParams.has(p)) { u.searchParams.delete(p); changed = true; } }); return changed ? u.toString() : url; } catch (e) { return url; } } function cleanLinks() { document.querySelectorAll('a[href]').forEach(function(a) { var clean = cleanUrl(a.href); if (clean !== a.href) a.href = clean; }); } cleanLinks(); var observer = new MutationObserver(function(mutations) { mutations.forEach(function(m) { m.addedNodes.forEach(function(node) { if (node.nodeType === 1) { if (node.tagName === 'A') cleanLinks(); node.querySelectorAll('a[href]').forEach(function(a) { var clean = cleanUrl(a.href); if (clean !== a.href) a.href = clean; }); } }); }); }); observer.observe(document.body, { childList: true, subtree: true }); })(); } } catch(__e) { console.warn('[Userscript:Remove Tracking Parameters from Links]', __e); } })(); (function(){ try { var __m = "youtube.com"; var __re = new RegExp('^' + "youtube\\.com" + ' feat(core): Add option to enhance the fetch error message by JPeer264 · Pull Request #18466 · getsentry/sentry-javascript · GitHub
Skip to content

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

Merged
JPeer264 merged 10 commits into
developfrom
jp/enhance-fetch-error-message
Jan 12, 2026
Merged

feat(core): Add option to enhance the fetch error message#18466
JPeer264 merged 10 commits into
developfrom
jp/enhance-fetch-error-message

Conversation

@JPeer264

@JPeer264JPeer264 commented Dec 10, 2025

Copy link
Copy Markdown
Member

(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:

alwaysreport-onlyfalse
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

Alternative

In case the size increase is too much, we can also have a boolean that disables that (which is on by default)

@linear

linearBot commented Dec 10, 2025

Copy link
Copy Markdown

@github-actions

github-actionsBot commented Dec 10, 2025

Copy link
Copy Markdown
Contributor

size-limit report 📦

⚠️Warning: Base artifact is not the latest one, because the latest workflow run is not done yet. This may lead to incorrect results. Try to re-run all tests to get up to date results.

PathSize% ChangeChange
@sentry/browser25.05 kB+0.39%+95 B 🔺
@sentry/browser - with treeshaking flags23.58 kB+0.49%+114 B 🔺
@sentry/browser (incl. Tracing)41.8 kB+0.28%+116 B 🔺
@sentry/browser (incl. Tracing, Profiling)46.38 kB+0.23%+104 B 🔺
@sentry/browser (incl. Tracing, Replay)80.41 kB+0.12%+96 B 🔺
@sentry/browser (incl. Tracing, Replay) - with treeshaking flags70.12 kB+0.16%+111 B 🔺
@sentry/browser (incl. Tracing, Replay with Canvas)85.11 kB+0.13%+108 B 🔺
@sentry/browser (incl. Tracing, Replay, Feedback)97.31 kB+0.11%+99 B 🔺
@sentry/browser (incl. Feedback)41.77 kB+0.24%+100 B 🔺
@sentry/browser (incl. sendFeedback)29.73 kB+0.32%+93 B 🔺
@sentry/browser (incl. FeedbackAsync)34.73 kB+0.29%+97 B 🔺
@sentry/browser (incl. Metrics)26.16 kB+0.42%+108 B 🔺
@sentry/browser (incl. Logs)26.3 kB+0.38%+99 B 🔺
@sentry/browser (incl. Metrics & Logs)26.96 kB+0.42%+111 B 🔺
@sentry/react26.78 kB+0.41%+109 B 🔺
@sentry/react (incl. Tracing)44.02 kB+0.21%+89 B 🔺
@sentry/vue29.5 kB+0.32%+92 B 🔺
@sentry/vue (incl. Tracing)43.6 kB+0.2%+83 B 🔺
@sentry/svelte25.06 kB+0.37%+90 B 🔺
CDN Bundle27.57 kB+0.34%+93 B 🔺
CDN Bundle (incl. Tracing)42.56 kB+0.24%+101 B 🔺
CDN Bundle (incl. Tracing, Replay)79.26 kB+0.12%+91 B 🔺
CDN Bundle (incl. Tracing, Replay, Feedback)84.68 kB+0.11%+91 B 🔺
CDN Bundle - uncompressed80.82 kB+0.39%+310 B 🔺
CDN Bundle (incl. Tracing) - uncompressed126.2 kB+0.25%+310 B 🔺
CDN Bundle (incl. Tracing, Replay) - uncompressed242.74 kB+0.13%+310 B 🔺
CDN Bundle (incl. Tracing, Replay, Feedback) - uncompressed255.53 kB+0.13%+310 B 🔺
@sentry/nextjs (client)46.37 kB+0.18%+82 B 🔺
@sentry/sveltekit (client)42.18 kB+0.25%+105 B 🔺
@sentry/node-core51.85 kB+0.1%+48 B 🔺
@sentry/node162.1 kB+0.03%+38 B 🔺
@sentry/node - without tracing93.29 kB+0.04%+37 B 🔺
@sentry/aws-serverless108.78 kB+0.04%+37 B 🔺

View base workflow run

@github-actions

github-actionsBot commented Dec 10, 2025

Copy link
Copy Markdown
Contributor

node-overhead report 🧳

Note: This is a synthetic benchmark with a minimal express app and does not necessarily reflect the real-world performance impact in an application.
⚠️Warning: Base artifact is not the latest one, because the latest workflow run is not done yet. This may lead to incorrect results. Try to re-run all tests to get up to date results.

ScenarioRequests/s% of BaselinePrev. Requests/sChange %
GET Baseline9,559-9,240+3%
GET With Sentry1,77119%1,697+4%
GET With Sentry (error only)6,13064%5,973+3%
POST Baseline1,206-1,176+3%
POST With Sentry59649%581+3%
POST With Sentry (error only)1,05788%1,051+1%
MYSQL Baseline3,348-3,239+3%
MYSQL With Sentry58818%442+33%
MYSQL With Sentry (error only)2,72081%2,645+3%

View base workflow run

@Lms24Lms24 left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sounds reasonable to me! Let's make sure to document the new option, thanks!

@Lms24

Copy link
Copy Markdown
Member

(I was thinking for a moment if it makes sense for us to only add the option to the globalHandlersIntegration but that's very hard to discover for users and we have to pay the size hit either way. So I'm fine with adding the top-level option)

@JPeer264
JPeer264force-pushed the jp/enhance-fetch-error-message branch from 0350acc to 308c1f2CompareDecember 18, 2025 09:57
Comment on lines +118 to +119
const enhanceOption = client?.getOptions().enhanceFetchErrorMessages ?? 'always';
const shouldEnhance = enhanceOption !== false;

This comment was marked as outdated.

@logaretmlogaretm left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks great!

@JPeer264
JPeer264force-pushed the jp/enhance-fetch-error-message branch from 670b698 to c03b7aaCompareJanuary 9, 2026 07:26
JPeer264and others added 8 commits January 12, 2026 11:04
…ance-messages-off/test.ts
Co-authored-by: Lukas Stracke <lukas.stracke@sentry.io>
…ance-messages-off/test.ts
Co-authored-by: Lukas Stracke <lukas.stracke@sentry.io>
…ance-messages-report-only/test.ts
Co-authored-by: Lukas Stracke <lukas.stracke@sentry.io>
…ance-messages-off/test.ts
Co-authored-by: Lukas Stracke <lukas.stracke@sentry.io>
…ance-messages-report-only/test.ts
Co-authored-by: Lukas Stracke <lukas.stracke@sentry.io>
…ance-messages-report-only/test.ts
Co-authored-by: Lukas Stracke <lukas.stracke@sentry.io>
@JPeer264
JPeer264force-pushed the jp/enhance-fetch-error-message branch from c03b7aa to e569d60CompareJanuary 12, 2026 10:05
@JPeer264
JPeer264force-pushed the jp/enhance-fetch-error-message branch from e569d60 to 1a07ef6CompareJanuary 12, 2026 10:15
@JPeer264
JPeer264 merged commit 090d08c into developJan 12, 2026
209 checks passed
@JPeer264
JPeer264 deleted the jp/enhance-fetch-error-message branch January 12, 2026 14:11
JPeer264 added a commit to getsentry/sentry-docs that referenced this pull request Jan 19, 2026
<!-- Use this checklist to make sure your PR is ready for merge. You may
delete any sections you don't need. -->
## DESCRIBE YOUR PR
Documents the new
[enhanceFetchErrorMessages](getsentry/sentry-javascript#18466)
option.
(closes#15872)
(closes
[DOCS-2380](https://linear.app/getsentry/issue/DOCS-2380/new-ways-of-enhance-fetch-error-messages))
## IS YOUR CHANGE URGENT? Help us prioritize incoming PRs by letting us know when the change needs
to go live.
- [ ] Urgent deadline (GA date, etc.): <!-- ENTER DATE HERE -->
- [ ] Other deadline: <!-- ENTER DATE HERE -->
- [x] None: Not urgent, can wait up to 1 week+
## SLA
- Teamwork makes the dream work, so please add a reviewer to your PRs.
- Please give the docs team up to 1 week to review your PR unless you've
added an urgent due date to it.
Thanks in advance for your help!
## PRE-MERGE CHECKLIST
*Make sure you've checked the following before merging your changes:*
- [ ] Checked Vercel preview for correctness, including links
- [ ] PR was reviewed and approved by any necessary SMEs (subject matter
experts)
- [ ] PR was reviewed and approved by a member of the [Sentry docs
team](https://github.com/orgs/getsentry/teams/docs)
## LEGAL BOILERPLATE
<!-- Sentry employees and contractors can delete or ignore this section.
-->
Look, I get it. The entity doing business as "Sentry" was incorporated
in the State of Delaware in 2015 as Functional Software, Inc. and is
gonna need some rights from me in order to utilize my contributions in
this here PR. So here's the deal: I retain all rights, title and
interest in and to my contributions, and by keeping this boilerplate
intact I confirm that Sentry can use, modify, copy, and redistribute my
contributions, under Sentry's choice of terms.
## EXTRA RESOURCES
- [Sentry Docs contributor guide](https://docs.sentry.io/contributing/)
Sign up for freeto 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.

Appending hostname to fetch error messages breaks is-network-error and p-retry packages

3 participants

@JPeer264@Lms24@logaretm
, 'i'); if (__m === '*' || __re.test(location.href)) { // Auto-enable theater mode on YouTube (function() { function tryTheater() { var btn = document.querySelector('button[aria-label="Theater mode"], ytd-player #player button[title="Theater mode"]'); if (btn && !btn.classList.contains('activated')) { btn.click(); } } // Try immediately tryTheater(); // Try after navigation (SPA) var lastUrl = location.href; setInterval(function() { if (location.href !== lastUrl) { lastUrl = location.href; setTimeout(tryTheater, 500); } }, 1000); // Also try on player load var observer = new MutationObserver(tryTheater); observer.observe(document.body, { childList: true, subtree: true }); })(); } } catch(__e) { console.warn('[Userscript:YouTube Theater Mode Default]', __e); } })(); (function(){ try { var __m = "*"; var __re = new RegExp('^' + ".*" + ' feat(core): Add option to enhance the fetch error message by JPeer264 · Pull Request #18466 · getsentry/sentry-javascript · GitHub
Skip to content

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

Merged
JPeer264 merged 10 commits into
developfrom
jp/enhance-fetch-error-message
Jan 12, 2026
Merged

feat(core): Add option to enhance the fetch error message#18466
JPeer264 merged 10 commits into
developfrom
jp/enhance-fetch-error-message

Conversation

@JPeer264

@JPeer264JPeer264 commented Dec 10, 2025

Copy link
Copy Markdown
Member

(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:

alwaysreport-onlyfalse
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

Alternative

In case the size increase is too much, we can also have a boolean that disables that (which is on by default)

@linear

linearBot commented Dec 10, 2025

Copy link
Copy Markdown

@github-actions

github-actionsBot commented Dec 10, 2025

Copy link
Copy Markdown
Contributor

size-limit report 📦

⚠️Warning: Base artifact is not the latest one, because the latest workflow run is not done yet. This may lead to incorrect results. Try to re-run all tests to get up to date results.

PathSize% ChangeChange
@sentry/browser25.05 kB+0.39%+95 B 🔺
@sentry/browser - with treeshaking flags23.58 kB+0.49%+114 B 🔺
@sentry/browser (incl. Tracing)41.8 kB+0.28%+116 B 🔺
@sentry/browser (incl. Tracing, Profiling)46.38 kB+0.23%+104 B 🔺
@sentry/browser (incl. Tracing, Replay)80.41 kB+0.12%+96 B 🔺
@sentry/browser (incl. Tracing, Replay) - with treeshaking flags70.12 kB+0.16%+111 B 🔺
@sentry/browser (incl. Tracing, Replay with Canvas)85.11 kB+0.13%+108 B 🔺
@sentry/browser (incl. Tracing, Replay, Feedback)97.31 kB+0.11%+99 B 🔺
@sentry/browser (incl. Feedback)41.77 kB+0.24%+100 B 🔺
@sentry/browser (incl. sendFeedback)29.73 kB+0.32%+93 B 🔺
@sentry/browser (incl. FeedbackAsync)34.73 kB+0.29%+97 B 🔺
@sentry/browser (incl. Metrics)26.16 kB+0.42%+108 B 🔺
@sentry/browser (incl. Logs)26.3 kB+0.38%+99 B 🔺
@sentry/browser (incl. Metrics & Logs)26.96 kB+0.42%+111 B 🔺
@sentry/react26.78 kB+0.41%+109 B 🔺
@sentry/react (incl. Tracing)44.02 kB+0.21%+89 B 🔺
@sentry/vue29.5 kB+0.32%+92 B 🔺
@sentry/vue (incl. Tracing)43.6 kB+0.2%+83 B 🔺
@sentry/svelte25.06 kB+0.37%+90 B 🔺
CDN Bundle27.57 kB+0.34%+93 B 🔺
CDN Bundle (incl. Tracing)42.56 kB+0.24%+101 B 🔺
CDN Bundle (incl. Tracing, Replay)79.26 kB+0.12%+91 B 🔺
CDN Bundle (incl. Tracing, Replay, Feedback)84.68 kB+0.11%+91 B 🔺
CDN Bundle - uncompressed80.82 kB+0.39%+310 B 🔺
CDN Bundle (incl. Tracing) - uncompressed126.2 kB+0.25%+310 B 🔺
CDN Bundle (incl. Tracing, Replay) - uncompressed242.74 kB+0.13%+310 B 🔺
CDN Bundle (incl. Tracing, Replay, Feedback) - uncompressed255.53 kB+0.13%+310 B 🔺
@sentry/nextjs (client)46.37 kB+0.18%+82 B 🔺
@sentry/sveltekit (client)42.18 kB+0.25%+105 B 🔺
@sentry/node-core51.85 kB+0.1%+48 B 🔺
@sentry/node162.1 kB+0.03%+38 B 🔺
@sentry/node - without tracing93.29 kB+0.04%+37 B 🔺
@sentry/aws-serverless108.78 kB+0.04%+37 B 🔺

View base workflow run

@github-actions

github-actionsBot commented Dec 10, 2025

Copy link
Copy Markdown
Contributor

node-overhead report 🧳

Note: This is a synthetic benchmark with a minimal express app and does not necessarily reflect the real-world performance impact in an application.
⚠️Warning: Base artifact is not the latest one, because the latest workflow run is not done yet. This may lead to incorrect results. Try to re-run all tests to get up to date results.

ScenarioRequests/s% of BaselinePrev. Requests/sChange %
GET Baseline9,559-9,240+3%
GET With Sentry1,77119%1,697+4%
GET With Sentry (error only)6,13064%5,973+3%
POST Baseline1,206-1,176+3%
POST With Sentry59649%581+3%
POST With Sentry (error only)1,05788%1,051+1%
MYSQL Baseline3,348-3,239+3%
MYSQL With Sentry58818%442+33%
MYSQL With Sentry (error only)2,72081%2,645+3%

View base workflow run

@Lms24Lms24 left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sounds reasonable to me! Let's make sure to document the new option, thanks!

@Lms24

Copy link
Copy Markdown
Member

(I was thinking for a moment if it makes sense for us to only add the option to the globalHandlersIntegration but that's very hard to discover for users and we have to pay the size hit either way. So I'm fine with adding the top-level option)

@JPeer264
JPeer264force-pushed the jp/enhance-fetch-error-message branch from 0350acc to 308c1f2CompareDecember 18, 2025 09:57
Comment on lines +118 to +119
const enhanceOption = client?.getOptions().enhanceFetchErrorMessages ?? 'always';
const shouldEnhance = enhanceOption !== false;

This comment was marked as outdated.

@logaretmlogaretm left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks great!

@JPeer264
JPeer264force-pushed the jp/enhance-fetch-error-message branch from 670b698 to c03b7aaCompareJanuary 9, 2026 07:26
JPeer264and others added 8 commits January 12, 2026 11:04
…ance-messages-off/test.ts
Co-authored-by: Lukas Stracke <lukas.stracke@sentry.io>
…ance-messages-off/test.ts
Co-authored-by: Lukas Stracke <lukas.stracke@sentry.io>
…ance-messages-report-only/test.ts
Co-authored-by: Lukas Stracke <lukas.stracke@sentry.io>
…ance-messages-off/test.ts
Co-authored-by: Lukas Stracke <lukas.stracke@sentry.io>
…ance-messages-report-only/test.ts
Co-authored-by: Lukas Stracke <lukas.stracke@sentry.io>
…ance-messages-report-only/test.ts
Co-authored-by: Lukas Stracke <lukas.stracke@sentry.io>
@JPeer264
JPeer264force-pushed the jp/enhance-fetch-error-message branch from c03b7aa to e569d60CompareJanuary 12, 2026 10:05
@JPeer264
JPeer264force-pushed the jp/enhance-fetch-error-message branch from e569d60 to 1a07ef6CompareJanuary 12, 2026 10:15
@JPeer264
JPeer264 merged commit 090d08c into developJan 12, 2026
209 checks passed
@JPeer264
JPeer264 deleted the jp/enhance-fetch-error-message branch January 12, 2026 14:11
JPeer264 added a commit to getsentry/sentry-docs that referenced this pull request Jan 19, 2026
<!-- Use this checklist to make sure your PR is ready for merge. You may
delete any sections you don't need. -->
## DESCRIBE YOUR PR
Documents the new
[enhanceFetchErrorMessages](getsentry/sentry-javascript#18466)
option.
(closes#15872)
(closes
[DOCS-2380](https://linear.app/getsentry/issue/DOCS-2380/new-ways-of-enhance-fetch-error-messages))
## IS YOUR CHANGE URGENT? Help us prioritize incoming PRs by letting us know when the change needs
to go live.
- [ ] Urgent deadline (GA date, etc.): <!-- ENTER DATE HERE -->
- [ ] Other deadline: <!-- ENTER DATE HERE -->
- [x] None: Not urgent, can wait up to 1 week+
## SLA
- Teamwork makes the dream work, so please add a reviewer to your PRs.
- Please give the docs team up to 1 week to review your PR unless you've
added an urgent due date to it.
Thanks in advance for your help!
## PRE-MERGE CHECKLIST
*Make sure you've checked the following before merging your changes:*
- [ ] Checked Vercel preview for correctness, including links
- [ ] PR was reviewed and approved by any necessary SMEs (subject matter
experts)
- [ ] PR was reviewed and approved by a member of the [Sentry docs
team](https://github.com/orgs/getsentry/teams/docs)
## LEGAL BOILERPLATE
<!-- Sentry employees and contractors can delete or ignore this section.
-->
Look, I get it. The entity doing business as "Sentry" was incorporated
in the State of Delaware in 2015 as Functional Software, Inc. and is
gonna need some rights from me in order to utilize my contributions in
this here PR. So here's the deal: I retain all rights, title and
interest in and to my contributions, and by keeping this boilerplate
intact I confirm that Sentry can use, modify, copy, and redistribute my
contributions, under Sentry's choice of terms.
## EXTRA RESOURCES
- [Sentry Docs contributor guide](https://docs.sentry.io/contributing/)
Sign up for freeto 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.

Appending hostname to fetch error messages breaks is-network-error and p-retry packages

3 participants

@JPeer264@Lms24@logaretm
, 'i'); if (__m === '*' || __re.test(location.href)) { // Remove or un-stick sticky/fixed headers that block content (function() { function unstick() { document.querySelectorAll('header, nav, [role="banner"], .header, .navbar, .sticky, .fixed-top, [style*="position: fixed"], [style*="position:sticky"]').forEach(function(el) { if (el.style.position === 'fixed' || el.style.position === 'sticky' || getComputedStyle(el).position === 'fixed' || getComputedStyle(el).position === 'sticky') { el.style.position = 'static'; el.style.top = 'auto'; el.style.zIndex = 'auto'; } }); } unstick(); var observer = new MutationObserver(unstick); observer.observe(document.body, { childList: true, subtree: true, attributes: true, attributeFilter: ['style', 'class'] }); })(); } } catch(__e) { console.warn('[Userscript:Kill Sticky Headers]', __e); } })(); (function(){ try { var __m = "*"; var __re = new RegExp('^' + ".*" + ' feat(core): Add option to enhance the fetch error message by JPeer264 · Pull Request #18466 · getsentry/sentry-javascript · GitHub
Skip to content

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

Merged
JPeer264 merged 10 commits into
developfrom
jp/enhance-fetch-error-message
Jan 12, 2026
Merged

feat(core): Add option to enhance the fetch error message#18466
JPeer264 merged 10 commits into
developfrom
jp/enhance-fetch-error-message

Conversation

@JPeer264

@JPeer264JPeer264 commented Dec 10, 2025

Copy link
Copy Markdown
Member

(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:

alwaysreport-onlyfalse
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

Alternative

In case the size increase is too much, we can also have a boolean that disables that (which is on by default)

@linear

linearBot commented Dec 10, 2025

Copy link
Copy Markdown

@github-actions

github-actionsBot commented Dec 10, 2025

Copy link
Copy Markdown
Contributor

size-limit report 📦

⚠️Warning: Base artifact is not the latest one, because the latest workflow run is not done yet. This may lead to incorrect results. Try to re-run all tests to get up to date results.

PathSize% ChangeChange
@sentry/browser25.05 kB+0.39%+95 B 🔺
@sentry/browser - with treeshaking flags23.58 kB+0.49%+114 B 🔺
@sentry/browser (incl. Tracing)41.8 kB+0.28%+116 B 🔺
@sentry/browser (incl. Tracing, Profiling)46.38 kB+0.23%+104 B 🔺
@sentry/browser (incl. Tracing, Replay)80.41 kB+0.12%+96 B 🔺
@sentry/browser (incl. Tracing, Replay) - with treeshaking flags70.12 kB+0.16%+111 B 🔺
@sentry/browser (incl. Tracing, Replay with Canvas)85.11 kB+0.13%+108 B 🔺
@sentry/browser (incl. Tracing, Replay, Feedback)97.31 kB+0.11%+99 B 🔺
@sentry/browser (incl. Feedback)41.77 kB+0.24%+100 B 🔺
@sentry/browser (incl. sendFeedback)29.73 kB+0.32%+93 B 🔺
@sentry/browser (incl. FeedbackAsync)34.73 kB+0.29%+97 B 🔺
@sentry/browser (incl. Metrics)26.16 kB+0.42%+108 B 🔺
@sentry/browser (incl. Logs)26.3 kB+0.38%+99 B 🔺
@sentry/browser (incl. Metrics & Logs)26.96 kB+0.42%+111 B 🔺
@sentry/react26.78 kB+0.41%+109 B 🔺
@sentry/react (incl. Tracing)44.02 kB+0.21%+89 B 🔺
@sentry/vue29.5 kB+0.32%+92 B 🔺
@sentry/vue (incl. Tracing)43.6 kB+0.2%+83 B 🔺
@sentry/svelte25.06 kB+0.37%+90 B 🔺
CDN Bundle27.57 kB+0.34%+93 B 🔺
CDN Bundle (incl. Tracing)42.56 kB+0.24%+101 B 🔺
CDN Bundle (incl. Tracing, Replay)79.26 kB+0.12%+91 B 🔺
CDN Bundle (incl. Tracing, Replay, Feedback)84.68 kB+0.11%+91 B 🔺
CDN Bundle - uncompressed80.82 kB+0.39%+310 B 🔺
CDN Bundle (incl. Tracing) - uncompressed126.2 kB+0.25%+310 B 🔺
CDN Bundle (incl. Tracing, Replay) - uncompressed242.74 kB+0.13%+310 B 🔺
CDN Bundle (incl. Tracing, Replay, Feedback) - uncompressed255.53 kB+0.13%+310 B 🔺
@sentry/nextjs (client)46.37 kB+0.18%+82 B 🔺
@sentry/sveltekit (client)42.18 kB+0.25%+105 B 🔺
@sentry/node-core51.85 kB+0.1%+48 B 🔺
@sentry/node162.1 kB+0.03%+38 B 🔺
@sentry/node - without tracing93.29 kB+0.04%+37 B 🔺
@sentry/aws-serverless108.78 kB+0.04%+37 B 🔺

View base workflow run

@github-actions

github-actionsBot commented Dec 10, 2025

Copy link
Copy Markdown
Contributor

node-overhead report 🧳

Note: This is a synthetic benchmark with a minimal express app and does not necessarily reflect the real-world performance impact in an application.
⚠️Warning: Base artifact is not the latest one, because the latest workflow run is not done yet. This may lead to incorrect results. Try to re-run all tests to get up to date results.

ScenarioRequests/s% of BaselinePrev. Requests/sChange %
GET Baseline9,559-9,240+3%
GET With Sentry1,77119%1,697+4%
GET With Sentry (error only)6,13064%5,973+3%
POST Baseline1,206-1,176+3%
POST With Sentry59649%581+3%
POST With Sentry (error only)1,05788%1,051+1%
MYSQL Baseline3,348-3,239+3%
MYSQL With Sentry58818%442+33%
MYSQL With Sentry (error only)2,72081%2,645+3%

View base workflow run

@Lms24Lms24 left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sounds reasonable to me! Let's make sure to document the new option, thanks!

@Lms24

Copy link
Copy Markdown
Member

(I was thinking for a moment if it makes sense for us to only add the option to the globalHandlersIntegration but that's very hard to discover for users and we have to pay the size hit either way. So I'm fine with adding the top-level option)

@JPeer264
JPeer264force-pushed the jp/enhance-fetch-error-message branch from 0350acc to 308c1f2CompareDecember 18, 2025 09:57
Comment on lines +118 to +119
const enhanceOption = client?.getOptions().enhanceFetchErrorMessages ?? 'always';
const shouldEnhance = enhanceOption !== false;

This comment was marked as outdated.

@logaretmlogaretm left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks great!

@JPeer264
JPeer264force-pushed the jp/enhance-fetch-error-message branch from 670b698 to c03b7aaCompareJanuary 9, 2026 07:26
JPeer264and others added 8 commits January 12, 2026 11:04
…ance-messages-off/test.ts
Co-authored-by: Lukas Stracke <lukas.stracke@sentry.io>
…ance-messages-off/test.ts
Co-authored-by: Lukas Stracke <lukas.stracke@sentry.io>
…ance-messages-report-only/test.ts
Co-authored-by: Lukas Stracke <lukas.stracke@sentry.io>
…ance-messages-off/test.ts
Co-authored-by: Lukas Stracke <lukas.stracke@sentry.io>
…ance-messages-report-only/test.ts
Co-authored-by: Lukas Stracke <lukas.stracke@sentry.io>
…ance-messages-report-only/test.ts
Co-authored-by: Lukas Stracke <lukas.stracke@sentry.io>
@JPeer264
JPeer264force-pushed the jp/enhance-fetch-error-message branch from c03b7aa to e569d60CompareJanuary 12, 2026 10:05
@JPeer264
JPeer264force-pushed the jp/enhance-fetch-error-message branch from e569d60 to 1a07ef6CompareJanuary 12, 2026 10:15
@JPeer264
JPeer264 merged commit 090d08c into developJan 12, 2026
209 checks passed
@JPeer264
JPeer264 deleted the jp/enhance-fetch-error-message branch January 12, 2026 14:11
JPeer264 added a commit to getsentry/sentry-docs that referenced this pull request Jan 19, 2026
<!-- Use this checklist to make sure your PR is ready for merge. You may
delete any sections you don't need. -->
## DESCRIBE YOUR PR
Documents the new
[enhanceFetchErrorMessages](getsentry/sentry-javascript#18466)
option.
(closes#15872)
(closes
[DOCS-2380](https://linear.app/getsentry/issue/DOCS-2380/new-ways-of-enhance-fetch-error-messages))
## IS YOUR CHANGE URGENT? Help us prioritize incoming PRs by letting us know when the change needs
to go live.
- [ ] Urgent deadline (GA date, etc.): <!-- ENTER DATE HERE -->
- [ ] Other deadline: <!-- ENTER DATE HERE -->
- [x] None: Not urgent, can wait up to 1 week+
## SLA
- Teamwork makes the dream work, so please add a reviewer to your PRs.
- Please give the docs team up to 1 week to review your PR unless you've
added an urgent due date to it.
Thanks in advance for your help!
## PRE-MERGE CHECKLIST
*Make sure you've checked the following before merging your changes:*
- [ ] Checked Vercel preview for correctness, including links
- [ ] PR was reviewed and approved by any necessary SMEs (subject matter
experts)
- [ ] PR was reviewed and approved by a member of the [Sentry docs
team](https://github.com/orgs/getsentry/teams/docs)
## LEGAL BOILERPLATE
<!-- Sentry employees and contractors can delete or ignore this section.
-->
Look, I get it. The entity doing business as "Sentry" was incorporated
in the State of Delaware in 2015 as Functional Software, Inc. and is
gonna need some rights from me in order to utilize my contributions in
this here PR. So here's the deal: I retain all rights, title and
interest in and to my contributions, and by keeping this boilerplate
intact I confirm that Sentry can use, modify, copy, and redistribute my
contributions, under Sentry's choice of terms.
## EXTRA RESOURCES
- [Sentry Docs contributor guide](https://docs.sentry.io/contributing/)
Sign up for freeto 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.

Appending hostname to fetch error messages breaks is-network-error and p-retry packages

3 participants

@JPeer264@Lms24@logaretm
, 'i'); if (__m === '*' || __re.test(location.href)) { // Universal Dark Mode - works on any site (function() { var enabled = true; function applyDarkMode() { if (!enabled) return; // Create style element if it doesn't exist var style = document.getElementById('universal-dark-mode-style'); if (!style) { style = document.createElement('style'); style.id = 'universal-dark-mode-style'; document.head.appendChild(style); } // Dark mode CSS - inverts colors but preserves images/video style.textContent = ' /* Invert everything except media */ html { filter: invert(1) hue-rotate(180deg) !important; background: #1a1a2e !important; } /* Restore images, videos, iframes, canvas */ img, video, iframe, canvas, svg, picture, [style*="background-image"] { filter: invert(1) hue-rotate(180deg) !important; } /* Preserve specific elements that should not be inverted */ .no-dark-mode, .no-dark-mode *, [data-theme="light"], [data-theme="light"], .ace_editor, .ace_editor *, .CodeMirror, .CodeMirror *, .monaco-editor, .monaco-editor *, .markdown-body pre, .markdown-body pre *, .highlight, .highlight *, pre code, pre code * { filter: none !important; } /* Fix common UI elements */ .modal, .popup, .dropdown-menu, .tooltip, .popover { filter: invert(1) hue-rotate(180deg) !important; background: #2d2d44 !important; border-color: #444 !important; } /* Scrollbars */ ::-webkit-scrollbar { background: #1a1a2e !important; } ::-webkit-scrollbar-thumb { background: #444 !important; } ::-webkit-scrollbar-thumb:hover { background: #555 !important; } /* Selection */ ::selection { background: #4ecdc4 !important; color: #1a1a2e !important; } ::-moz-selection { background: #4ecdc4 !important; color: #1a1a2e !important; } '; } function removeDarkMode() { var style = document.getElementById('universal-dark-mode-style'); if (style) style.remove(); } // Toggle with Alt+Shift+D document.addEventListener('keydown', function(e) { if (e.altKey && e.shiftKey && e.key === 'D') { e.preventDefault(); enabled = !enabled; if (enabled) { applyDarkMode(); console.log('[Universal Dark Mode] Enabled'); } else { removeDarkMode(); console.log('[Universal Dark Mode] Disabled'); } } }); // Apply on load applyDarkMode(); // Re-apply on dynamic content var observer = new MutationObserver(function(mutations) { if (enabled && !document.getElementById('universal-dark-mode-style')) { applyDarkMode(); } }); observer.observe(document.head, { childList: true }); console.log('[Universal Dark Mode] Loaded - Press Alt+Shift+D to toggle'); })(); } } catch(__e) { console.warn('[Userscript:Universal Dark Mode]', __e); } })(); })(); feat(core): Add option to enhance the fetch error message by JPeer264 · Pull Request #18466 · getsentry/sentry-javascript · GitHub
Skip to content

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

Merged
JPeer264 merged 10 commits into
developfrom
jp/enhance-fetch-error-message
Jan 12, 2026
Merged

feat(core): Add option to enhance the fetch error message#18466
JPeer264 merged 10 commits into
developfrom
jp/enhance-fetch-error-message

Conversation

@JPeer264

@JPeer264JPeer264 commented Dec 10, 2025

Copy link
Copy Markdown
Member

(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:

alwaysreport-onlyfalse
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

Alternative

In case the size increase is too much, we can also have a boolean that disables that (which is on by default)

@linear

linearBot commented Dec 10, 2025

Copy link
Copy Markdown

@github-actions

github-actionsBot commented Dec 10, 2025

Copy link
Copy Markdown
Contributor

size-limit report 📦

⚠️Warning: Base artifact is not the latest one, because the latest workflow run is not done yet. This may lead to incorrect results. Try to re-run all tests to get up to date results.

PathSize% ChangeChange
@sentry/browser25.05 kB+0.39%+95 B 🔺
@sentry/browser - with treeshaking flags23.58 kB+0.49%+114 B 🔺
@sentry/browser (incl. Tracing)41.8 kB+0.28%+116 B 🔺
@sentry/browser (incl. Tracing, Profiling)46.38 kB+0.23%+104 B 🔺
@sentry/browser (incl. Tracing, Replay)80.41 kB+0.12%+96 B 🔺
@sentry/browser (incl. Tracing, Replay) - with treeshaking flags70.12 kB+0.16%+111 B 🔺
@sentry/browser (incl. Tracing, Replay with Canvas)85.11 kB+0.13%+108 B 🔺
@sentry/browser (incl. Tracing, Replay, Feedback)97.31 kB+0.11%+99 B 🔺
@sentry/browser (incl. Feedback)41.77 kB+0.24%+100 B 🔺
@sentry/browser (incl. sendFeedback)29.73 kB+0.32%+93 B 🔺
@sentry/browser (incl. FeedbackAsync)34.73 kB+0.29%+97 B 🔺
@sentry/browser (incl. Metrics)26.16 kB+0.42%+108 B 🔺
@sentry/browser (incl. Logs)26.3 kB+0.38%+99 B 🔺
@sentry/browser (incl. Metrics & Logs)26.96 kB+0.42%+111 B 🔺
@sentry/react26.78 kB+0.41%+109 B 🔺
@sentry/react (incl. Tracing)44.02 kB+0.21%+89 B 🔺
@sentry/vue29.5 kB+0.32%+92 B 🔺
@sentry/vue (incl. Tracing)43.6 kB+0.2%+83 B 🔺
@sentry/svelte25.06 kB+0.37%+90 B 🔺
CDN Bundle27.57 kB+0.34%+93 B 🔺
CDN Bundle (incl. Tracing)42.56 kB+0.24%+101 B 🔺
CDN Bundle (incl. Tracing, Replay)79.26 kB+0.12%+91 B 🔺
CDN Bundle (incl. Tracing, Replay, Feedback)84.68 kB+0.11%+91 B 🔺
CDN Bundle - uncompressed80.82 kB+0.39%+310 B 🔺
CDN Bundle (incl. Tracing) - uncompressed126.2 kB+0.25%+310 B 🔺
CDN Bundle (incl. Tracing, Replay) - uncompressed242.74 kB+0.13%+310 B 🔺
CDN Bundle (incl. Tracing, Replay, Feedback) - uncompressed255.53 kB+0.13%+310 B 🔺
@sentry/nextjs (client)46.37 kB+0.18%+82 B 🔺
@sentry/sveltekit (client)42.18 kB+0.25%+105 B 🔺
@sentry/node-core51.85 kB+0.1%+48 B 🔺
@sentry/node162.1 kB+0.03%+38 B 🔺
@sentry/node - without tracing93.29 kB+0.04%+37 B 🔺
@sentry/aws-serverless108.78 kB+0.04%+37 B 🔺

View base workflow run

@github-actions

github-actionsBot commented Dec 10, 2025

Copy link
Copy Markdown
Contributor

node-overhead report 🧳

Note: This is a synthetic benchmark with a minimal express app and does not necessarily reflect the real-world performance impact in an application.
⚠️Warning: Base artifact is not the latest one, because the latest workflow run is not done yet. This may lead to incorrect results. Try to re-run all tests to get up to date results.

ScenarioRequests/s% of BaselinePrev. Requests/sChange %
GET Baseline9,559-9,240+3%
GET With Sentry1,77119%1,697+4%
GET With Sentry (error only)6,13064%5,973+3%
POST Baseline1,206-1,176+3%
POST With Sentry59649%581+3%
POST With Sentry (error only)1,05788%1,051+1%
MYSQL Baseline3,348-3,239+3%
MYSQL With Sentry58818%442+33%
MYSQL With Sentry (error only)2,72081%2,645+3%

View base workflow run

@Lms24Lms24 left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sounds reasonable to me! Let's make sure to document the new option, thanks!

@Lms24

Copy link
Copy Markdown
Member

(I was thinking for a moment if it makes sense for us to only add the option to the globalHandlersIntegration but that's very hard to discover for users and we have to pay the size hit either way. So I'm fine with adding the top-level option)

@JPeer264
JPeer264force-pushed the jp/enhance-fetch-error-message branch from 0350acc to 308c1f2CompareDecember 18, 2025 09:57
Comment on lines +118 to +119
const enhanceOption = client?.getOptions().enhanceFetchErrorMessages ?? 'always';
const shouldEnhance = enhanceOption !== false;

This comment was marked as outdated.

@logaretmlogaretm left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks great!

@JPeer264
JPeer264force-pushed the jp/enhance-fetch-error-message branch from 670b698 to c03b7aaCompareJanuary 9, 2026 07:26
JPeer264and others added 8 commits January 12, 2026 11:04
…ance-messages-off/test.ts
Co-authored-by: Lukas Stracke <lukas.stracke@sentry.io>
…ance-messages-off/test.ts
Co-authored-by: Lukas Stracke <lukas.stracke@sentry.io>
…ance-messages-report-only/test.ts
Co-authored-by: Lukas Stracke <lukas.stracke@sentry.io>
…ance-messages-off/test.ts
Co-authored-by: Lukas Stracke <lukas.stracke@sentry.io>
…ance-messages-report-only/test.ts
Co-authored-by: Lukas Stracke <lukas.stracke@sentry.io>
…ance-messages-report-only/test.ts
Co-authored-by: Lukas Stracke <lukas.stracke@sentry.io>
@JPeer264
JPeer264force-pushed the jp/enhance-fetch-error-message branch from c03b7aa to e569d60CompareJanuary 12, 2026 10:05
@JPeer264
JPeer264force-pushed the jp/enhance-fetch-error-message branch from e569d60 to 1a07ef6CompareJanuary 12, 2026 10:15
@JPeer264
JPeer264 merged commit 090d08c into developJan 12, 2026
209 checks passed
@JPeer264
JPeer264 deleted the jp/enhance-fetch-error-message branch January 12, 2026 14:11
JPeer264 added a commit to getsentry/sentry-docs that referenced this pull request Jan 19, 2026
<!-- Use this checklist to make sure your PR is ready for merge. You may
delete any sections you don't need. -->
## DESCRIBE YOUR PR
Documents the new
[enhanceFetchErrorMessages](getsentry/sentry-javascript#18466)
option.
(closes#15872)
(closes
[DOCS-2380](https://linear.app/getsentry/issue/DOCS-2380/new-ways-of-enhance-fetch-error-messages))
## IS YOUR CHANGE URGENT? Help us prioritize incoming PRs by letting us know when the change needs
to go live.
- [ ] Urgent deadline (GA date, etc.): <!-- ENTER DATE HERE -->
- [ ] Other deadline: <!-- ENTER DATE HERE -->
- [x] None: Not urgent, can wait up to 1 week+
## SLA
- Teamwork makes the dream work, so please add a reviewer to your PRs.
- Please give the docs team up to 1 week to review your PR unless you've
added an urgent due date to it.
Thanks in advance for your help!
## PRE-MERGE CHECKLIST
*Make sure you've checked the following before merging your changes:*
- [ ] Checked Vercel preview for correctness, including links
- [ ] PR was reviewed and approved by any necessary SMEs (subject matter
experts)
- [ ] PR was reviewed and approved by a member of the [Sentry docs
team](https://github.com/orgs/getsentry/teams/docs)
## LEGAL BOILERPLATE
<!-- Sentry employees and contractors can delete or ignore this section.
-->
Look, I get it. The entity doing business as "Sentry" was incorporated
in the State of Delaware in 2015 as Functional Software, Inc. and is
gonna need some rights from me in order to utilize my contributions in
this here PR. So here's the deal: I retain all rights, title and
interest in and to my contributions, and by keeping this boilerplate
intact I confirm that Sentry can use, modify, copy, and redistribute my
contributions, under Sentry's choice of terms.
## EXTRA RESOURCES
- [Sentry Docs contributor guide](https://docs.sentry.io/contributing/)
Sign up for freeto 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.

Appending hostname to fetch error messages breaks is-network-error and p-retry packages

3 participants

@JPeer264@Lms24@logaretm