Repository navigation
chore(lint): Require a mechanism on captureException calls in SDK code - #26880
Open
sentry-junior[bot] wants to merge 2 commits into
Open
sentry-junior[bot] wants to merge 2 commits into
sentry-junior[bot] wants to merge 2 commits into
Conversation
Adds `sdk/require-exception-mechanism`, which flags `captureException` calls in `src` whose hint does not set `mechanism.handled` and `mechanism.type`. Sets the missing `type` on the Vue Router `onError` capture. Co-Authored-By: Francesco Gringl-Novy <2411343+mydea@users.noreply.github.com>
4 of 13 tasks
Contributor
size-limit report 📦Compared: 9a8b64b (PR test merge using develop at 40fb1a8) Against: 40fb1a8 (develop) · base run #67947 ✅ Baseline matches: this diff contains only this PR's changes.
|
Contributor
Optional E2E testsSome optional checks were not successful. They do not block the merge. 2 not successful, 84 successful. See the run.
Successful checks
|
mydea
reviewed
Nov 25, 2026
mydea
reviewed
Nov 25, 2026
`markEventUnhandled(scope, type)` sets `{ handled: false, type }` for the
serverless SDKs, so a capture context callback that returns it satisfies
`sdk/require-exception-mechanism` without a disable comment.
mydea
marked this pull request as ready for review
November 25, 2026 14:22
javascript-sdk-gitflow
Bot
requested review from
logaretm,
s1gr1d and
timfish
November 25, 2026 14:22
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What
Adds
sdk/require-exception-mechanismfor**/src/**. It flagscaptureExceptioncalls whose hint isn't an object literal with amechanismthat sets bothhandledandtype. It trusts amechanismthat isn't a literal, such as a shared constant, and a capture context callback that returnsmarkEventUnhandled(scope, type), the pattern the serverless SDKs use.onErrorerrors now getmechanism.type: 'auto.function.vue.router'instead of falling back togeneric.handled: falseis unchanged.{ mechanism: trpcMechanism }. The payload doesn't change.wrap, captureConsole, supabase, remix server and pino. 5 pass a caller's hint through:captureExceptioninexports.ts,Scope,ServerRuntimeClient,captureReactExceptionand the tracing-channelcaptureErrorhook. 6 are the bundler plugin's own telemetry inbuild-plugin-manager.ts, which gets one file-level disable.captureExceptionrule in.cursor/BUGBOT.mdnow covers only what lint can't see: whethertypeis a good name and matches the span origin.Why
Without a mechanism, an event shows up as
generic/handled, so you can't tell which integration caught the error. The rule also covers member calls (scope.,client.,Sentry.captureException) because they feed the same event pipeline. The only member hits are internal passthroughs, which are cheap to mark.A check that
typefollows the origin convention is left for a follow-up. Mechanism types likegeneric,chainedandinstrumentare valid but don't fit it, and a few auto types use hyphens or camelCase (auto.function.node-cron.instrumentNodeCron,auto.ai.openai.stream-response).Part of #26852
via @mydea.
--
View Session [Sentry]