Skip to content

feat(core): Isolate throwing user callbacks instead of capturing them as events - #23770

Draft
msonnb wants to merge 1 commit into
ms/safe-callback-helperfrom
ms/safe-callback-user-callbacks
Draft

feat(core): Isolate throwing user callbacks instead of capturing them as events#23770
msonnb wants to merge 1 commit into
ms/safe-callback-helperfrom
ms/safe-callback-user-callbacks

Conversation

@msonnb

@msonnb msonnb commented Aug 31, 2026

Copy link
Copy Markdown
Member

Wraps beforeSend, beforeSendTransaction, event processors, tracesSampler, beforeBreadcrumb, beforeSendLog and beforeSendMetric in the safeCallback helper from #23760. A throwing or rejecting callback no longer escapes into the calling code and is no longer captured as an internal error event; the event/breadcrumb/log/metric is dropped, a client report is recorded where a category exists, and the error is logged in debug mode.

part of #23755

…m as events

Wraps `beforeSend`, `beforeSendTransaction`, event processors, `tracesSampler`,
`beforeBreadcrumb`, `beforeSendLog` and `beforeSendMetric` in `safeCallback`.
A throwing or rejecting callback now drops the event/breadcrumb/log/metric
(with a client report where one exists) instead of escaping into the calling
code or being captured as an `internal` error event. `tracesSampler` falls back
to the parent sampling decision, then `tracesSampleRate`.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
@linear-code

linear-code Bot commented Aug 31, 2026

Copy link
Copy Markdown

JS-3474

@msonnb msonnb changed the title feat(core)!: Isolate throwing user callbacks instead of capturing them as events feat(core): Isolate throwing user callbacks instead of capturing them as events Aug 31, 2026
@msonnb

msonnb commented Aug 31, 2026

Copy link
Copy Markdown
Member Author

bugbot run

@github-actions

Copy link
Copy Markdown
Contributor

size-limit report 📦

Path Size % Change Change
@sentry/browser 28.69 kB added added
@sentry/browser - with treeshaking flags 27.01 kB added added
@sentry/browser - with treeshaking flags tracing without tracing 26.9 kB added added
@sentry/browser (incl. Tracing) 48.89 kB added added
@sentry/browser (incl. Tracing + Span Streaming) 48.92 kB added added
@sentry/browser (incl. Tracing, Profiling) 51.84 kB added added
@sentry/browser (incl. Tracing, Replay) 88.39 kB added added
@sentry/browser (incl. Tracing, Replay) - with treeshaking flags 77.69 kB added added
@sentry/browser (incl. Tracing, Replay with Canvas) 93.09 kB added added
@sentry/browser (incl. Tracing, Replay, Feedback) 106.02 kB added added
@sentry/browser (incl. Feedback) 46.18 kB added added
@sentry/browser (incl. sendFeedback) 33.76 kB added added
@sentry/browser (incl. FeedbackAsync) 38.85 kB added added
@sentry/browser (incl. Metrics) 29.66 kB added added
@sentry/browser (incl. Logs) 29.94 kB added added
@sentry/browser (incl. Metrics & Logs) 30.59 kB added added
@sentry/react 30.46 kB added added
@sentry/react (incl. Tracing) 51.15 kB added added
@sentry/vue 35.91 kB added added
@sentry/vue (incl. Tracing) 51.2 kB added added
@sentry/svelte 28.71 kB added added
CDN Bundle 30.45 kB added added
CDN Bundle (incl. Tracing) 49.45 kB added added
CDN Bundle (incl. Logs, Metrics) 32.68 kB added added
CDN Bundle (incl. Tracing, Logs, Metrics) 51.38 kB added added
CDN Bundle (incl. Replay, Logs, Metrics) 73.28 kB added added
CDN Bundle (incl. Tracing, Replay) 86.95 kB added added
CDN Bundle (incl. Tracing, Replay, Logs, Metrics) 88.84 kB added added
CDN Bundle (incl. Tracing, Replay, Feedback) 92.84 kB added added
CDN Bundle (incl. Tracing, Replay, Feedback, Logs, Metrics) 94.75 kB added added
CDN Bundle - uncompressed 90.17 kB added added
CDN Bundle (incl. Tracing) - uncompressed 147.35 kB added added
CDN Bundle (incl. Logs, Metrics) - uncompressed 96.56 kB added added
CDN Bundle (incl. Tracing, Logs, Metrics) - uncompressed 153.13 kB added added
CDN Bundle (incl. Replay, Logs, Metrics) - uncompressed 225.73 kB added added
CDN Bundle (incl. Tracing, Replay) - uncompressed 266.85 kB added added
CDN Bundle (incl. Tracing, Replay, Logs, Metrics) - uncompressed 272.62 kB added added
CDN Bundle (incl. Tracing, Replay, Feedback) - uncompressed 280.55 kB added added
CDN Bundle (incl. Tracing, Replay, Feedback, Logs, Metrics) - uncompressed 286.31 kB added added
@sentry/nextjs (client) 53.72 kB added added
@sentry/sveltekit (client) 49.35 kB added added
@sentry/core/server 65.7 kB added added
@sentry/core/browser 52.06 kB added added
@sentry/node 123.64 kB added added
@sentry/node/import (ESM hook with diagnostics-channel injection) 85.23 kB added added
@sentry/node - without tracing 87.94 kB added added
@sentry/node - without channel injection 103.29 kB added added
@sentry/aws-serverless 96.27 kB added added
@sentry/cloudflare (withSentry) - minified 201.37 kB added added
@sentry/cloudflare (withSentry) 500.63 kB added added

@cursor cursor Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

✅ Bugbot reviewed your changes and found no new issues!

Comment @cursor review or bugbot run to trigger another review on this PR

Reviewed by Cursor Bugbot for commit 5336fc6. Configure here.

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.

1 participant