Skip to content

Conversation

RulaKhaled
Copy link
Member

I’m introducing support for selectively suppressing specific errors. This is done by adding a new option that allows users to override the default logging modes. By passing this option down through the configuration, users will have finer control over which errors are logged versus ignored. Also added a default array for the errors, addressing an issue where Vercel’s flush is called during abort, causing unnecessary error logs.

Copy link
Contributor

github-actions bot commented Sep 22, 2025

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.

Path Size % Change Change
@sentry/browser 24.23 kB - -
@sentry/browser - with treeshaking flags 22.75 kB - -
@sentry/browser (incl. Tracing) 40.42 kB - -
@sentry/browser (incl. Tracing, Replay) 78.8 kB - -
@sentry/browser (incl. Tracing, Replay) - with treeshaking flags 68.45 kB - -
@sentry/browser (incl. Tracing, Replay with Canvas) 83.47 kB - -
@sentry/browser (incl. Tracing, Replay, Feedback) 95.67 kB - -
@sentry/browser (incl. Feedback) 40.95 kB - -
@sentry/browser (incl. sendFeedback) 28.89 kB - -
@sentry/browser (incl. FeedbackAsync) 33.82 kB - -
@sentry/react 25.96 kB - -
@sentry/react (incl. Tracing) 42.39 kB - -
@sentry/vue 28.75 kB - -
@sentry/vue (incl. Tracing) 42.23 kB - -
@sentry/svelte 24.26 kB - -
CDN Bundle 25.75 kB - -
CDN Bundle (incl. Tracing) 40.31 kB - -
CDN Bundle (incl. Tracing, Replay) 76.55 kB - -
CDN Bundle (incl. Tracing, Replay, Feedback) 82.06 kB - -
CDN Bundle - uncompressed 75.3 kB - -
CDN Bundle (incl. Tracing) - uncompressed 119.31 kB - -
CDN Bundle (incl. Tracing, Replay) - uncompressed 234.47 kB - -
CDN Bundle (incl. Tracing, Replay, Feedback) - uncompressed 247.23 kB - -
@sentry/nextjs (client) 44.4 kB - -
@sentry/sveltekit (client) 40.84 kB - -
@sentry/node-core 50.47 kB +0.29% +145 B 🔺
@sentry/node 153.57 kB +0.11% +161 B 🔺
@sentry/node - without tracing 92.33 kB +0.17% +148 B 🔺
@sentry/aws-serverless 106.03 kB +0.14% +139 B 🔺

View base workflow run

Copy link
Contributor

github-actions bot commented Sep 22, 2025

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.

Scenario Requests/s % of Baseline Prev. Requests/s Change %
GET Baseline 9,115 - 8,751 +4%
GET With Sentry 1,393 15% 1,364 +2%
GET With Sentry (error only) 6,192 68% 6,128 +1%
POST Baseline 1,213 - 1,213 -
POST With Sentry 526 43% 519 +1%
POST With Sentry (error only) 1,056 87% 1,059 -0%
MYSQL Baseline 3,347 - 3,381 -1%
MYSQL With Sentry 489 15% 443 +10%
MYSQL With Sentry (error only) 2,754 82% 2,739 +1%

View base workflow run

@RulaKhaled RulaKhaled marked this pull request as ready for review September 30, 2025 16:15
Copy link
Member

@Lms24 Lms24 left a comment

Choose a reason for hiding this comment

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

Sorry for the delay but LGTM overall! I had some suggestions to reuse some helpers but feel free to merge this once addressed!

Comment on lines 45 to 46
const isObject = reason !== null && typeof reason === 'object';
if (!isObject) {
Copy link
Member

Choose a reason for hiding this comment

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

l: we can reuse isPlainObject here

Copy link
Member Author

Choose a reason for hiding this comment

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

plain object will return false for isPlainObject(new Error('')))

Copy link
Member

Choose a reason for hiding this comment

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

ah right, ok then let's leave it as is, thanks for checking!

return { name: '', message: String(reason ?? ''), isObject };
}

const errorLike = reason as Record<string, unknown>;
Copy link
Member

Choose a reason for hiding this comment

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

using isPlainObject above should also let us get rid of the type cast here

Comment on lines 68 to 78
const nameMatches =
matcher.name === undefined ||
(typeof matcher.name === 'string' ? errorInfo.name === matcher.name : matcher.name.test(errorInfo.name));

const messageMatches =
matcher.message === undefined ||
(typeof matcher.message === 'string'
? errorInfo.message.includes(matcher.message)
: matcher.message.test(errorInfo.message));

return nameMatches && messageMatches;
Copy link
Member

Choose a reason for hiding this comment

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

I'd recommend reusing isStringOrRegex and isMatchingPattern here, to streamline this a bit :)

// name/message matcher
const nameMatches = matcher.name === undefined || isMatchingPattern(errorInfo.name, matcher.name, true);

const messageMatches = matcher.message === undefined || isMatchingPattern(errorInfo.message, matcher.message);
Copy link

Choose a reason for hiding this comment

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

Bug: Inconsistent Pattern Matching Causes Unhandled Rejections

The isMatchingPattern function is called inconsistently for error names and messages. Name matching includes a third true parameter, while message matching omits it. This leads to different matching behaviors (e.g., case sensitivity) and potentially unexpected ignore functionality for unhandled rejections.

Fix in Cursor Fix in Web

@RulaKhaled RulaKhaled merged commit 985873e into develop Oct 1, 2025
189 checks passed
@RulaKhaled RulaKhaled deleted the fix-bug branch October 1, 2025 12:57
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.

4 participants