Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ref(core): Avoid using SentryError for event processing control flow #15823

Merged
merged 4 commits into from
Mar 25, 2025

Conversation

mydea
Copy link
Member

@mydea mydea commented Mar 25, 2025

This PR replaces our usage of SentryError for control flow in our event processing.
Instead, we now throw either an InternalError or DoNotSendEventError (which are just POJOs with a symbol, without a stackframe). These two also allow us to differentiate between these two use cases, which so far have been kind of combined via the log level, but are really different things - one is "expected"/configured by a user, the other is unexpected and more of a warning.

I also removed the handling for SentryError from inbound filters, as this should then become unused.

This also deprecates SentryError, it is no longer used and we can eventually remove it.

ref #15725 (comment)

@mydea mydea self-assigned this Mar 25, 2025
@mydea mydea requested a review from lforst March 25, 2025 13:39
Copy link
Contributor

github-actions bot commented Mar 25, 2025

size-limit report 📦

Path Size % Change Change
@sentry/browser 23.06 KB -0.12% -26 B 🔽
@sentry/browser - with treeshaking flags 22.86 KB -0.14% -31 B 🔽
@sentry/browser (incl. Tracing) 36.47 KB -0.1% -36 B 🔽
@sentry/browser (incl. Tracing, Replay) 73.63 KB -0.05% -34 B 🔽
@sentry/browser (incl. Tracing, Replay) - with treeshaking flags 66.98 KB -0.09% -58 B 🔽
@sentry/browser (incl. Tracing, Replay with Canvas) 78.27 KB -0.04% -27 B 🔽
@sentry/browser (incl. Tracing, Replay, Feedback) 90.85 KB -0.04% -35 B 🔽
@sentry/browser (incl. Feedback) 40.19 KB -0.09% -37 B 🔽
@sentry/browser (incl. sendFeedback) 27.69 KB -0.09% -24 B 🔽
@sentry/browser (incl. FeedbackAsync) 32.48 KB -0.1% -33 B 🔽
@sentry/react 24.84 KB -0.18% -44 B 🔽
@sentry/react (incl. Tracing) 38.37 KB -0.07% -27 B 🔽
@sentry/vue 27.28 KB -0.11% -29 B 🔽
@sentry/vue (incl. Tracing) 38.16 KB -0.06% -23 B 🔽
@sentry/svelte 23.1 KB -0.12% -27 B 🔽
CDN Bundle 24.31 KB -0.04% -8 B 🔽
CDN Bundle (incl. Tracing) 36.49 KB -0.02% -5 B 🔽
CDN Bundle (incl. Tracing, Replay) 71.5 KB +0.01% +4 B 🔺
CDN Bundle (incl. Tracing, Replay, Feedback) 76.69 KB -0.02% -14 B 🔽
CDN Bundle - uncompressed 70.88 KB -0.09% -62 B 🔽
CDN Bundle (incl. Tracing) - uncompressed 108.07 KB -0.06% -62 B 🔽
CDN Bundle (incl. Tracing, Replay) - uncompressed 219.32 KB -0.03% -62 B 🔽
CDN Bundle (incl. Tracing, Replay, Feedback) - uncompressed 231.88 KB -0.03% -62 B 🔽
@sentry/nextjs (client) 39.66 KB -0.09% -34 B 🔽
@sentry/sveltekit (client) 36.9 KB -0.01% -3 B 🔽
@sentry/node 142.7 KB -0.02% -19 B 🔽
@sentry/node - without tracing 96.09 KB -0.03% -27 B 🔽
@sentry/aws-serverless 120.44 KB -0.03% -27 B 🔽

View base workflow run

Comment on lines 98 to 104
function isInternalError(error: unknown): error is InternalError {
return !!error && typeof error === 'object' && INTERNAL_ERROR_SYMBOL in error;
}

function isDoNotSendEventError(error: unknown): error is DoNotSendEventError {
return !!error && typeof error === 'object' && DO_NOT_SEND_EVENT_SYMBOL in error;
}
Copy link
Member

Choose a reason for hiding this comment

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

Although we want to differentiate them, we can use a single isX method for now given everything checks for both:

function isClientProcessingError(error: unknown): error is InternalError | DoNotSendEventError {
  return !!error && typeof error === 'object' && (INTERNAL_ERROR_SYMBOL in error || DO_NOT_SEND_EVENT_SYMBOL in error);
}

Copy link
Member Author

Choose a reason for hiding this comment

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

actually it is not entirely the same, today we differentiate based on this if we do logger.log or logger.warn. Not sure how important that is to us though 🤔

Copy link
Member

Choose a reason for hiding this comment

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

I guess we can keep them separate for now then.

@mydea mydea force-pushed the fn/event-pipeline-sentry-error branch from be83d3f to 19c86a4 Compare March 25, 2025 14:50
@mydea mydea marked this pull request as ready for review March 25, 2025 14:51
@mydea mydea force-pushed the fn/event-pipeline-sentry-error branch from 8fe61d1 to 08a50f1 Compare March 25, 2025 15:00
@mydea mydea merged commit c14ab92 into develop Mar 25, 2025
151 of 152 checks passed
@mydea mydea deleted the fn/event-pipeline-sentry-error branch March 25, 2025 15:56
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.

3 participants