Title: Ensure SDK-captured error events have a proper `mechanism` · Issue #17212 · getsentry/sentry-javascript · GitHub
Open Graph Title: Ensure SDK-captured error events have a proper `mechanism` · Issue #17212 · getsentry/sentry-javascript
X Title: Ensure SDK-captured error events have a proper `mechanism` · Issue #17212 · getsentry/sentry-javascript
Description: Description When Sentry SDKs capture errors (e.g. via captureException), they include a mechanism field on the captured exception(s). Among other metadata, the mechanism most importantly contains the following properties: handled: boolea...
Open Graph Description: Description When Sentry SDKs capture errors (e.g. via captureException), they include a mechanism field on the captured exception(s). Among other metadata, the mechanism most importantly contains t...
X Description: Description When Sentry SDKs capture errors (e.g. via captureException), they include a mechanism field on the captured exception(s). Among other metadata, the mechanism most importantly contains t...
Opengraph URL: https://github.com/getsentry/sentry-javascript/issues/17212
X: @github
Domain: github.com
IPv4 address: 140.82.112.4
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"Ensure SDK-captured error events have a proper `mechanism`","articleBody":"### Description\n\nWhen Sentry SDKs capture errors (e.g. via `captureException`), they include a [`mechanism` field](https://develop.sentry.dev/sdk/data-model/event-payloads/exception/#exception-mechanism) on the captured exception(s). Among other metadata, the mechanism most importantly contains the following properties:\n\n- `handled: boolean`: a boolean indicating if the captured exception was handled by users or not. (this is a hard/impossible decision sometimes, so we rather tend to `false` in cases where we don't know. The limitations around this are another topic and out of scope for this issue)\n- `type: string`: an identifier which mechanism (or part of the SDK) captured the error.\n\nBy default, e.g. if users call `captureException`, the mechanism defaults to:\n\n```js\n{\n handled: true,\n type: 'generic'\n}\n``` \n\nHowever, ideally, our SDK instrumentation sets a custom mechanism for automatically captured errors, depending on which instrumentation or part of the SDK captured the error. For example:\n\n```js\ncaptureException(error, {\n mechanism: {\n handled: false,\n type: 'solidstart',\n },\n});\n```\n\nUnfortunately, we don't do this consistently across all SDKs, integrations or generally places where we call `captureException`. We should change this and align on always setting `handled` and `type`.\n\n`type` naming pattern:\n\n- should align with `sentry.origin` (aka [Trace Origin](https://develop.sentry.dev/sdk/telemetry/traces/trace-origin/)) as much as possible (e.g. whenever we capture within a specific span).\n- if N/A directly, make sure naming pattern follows trace origin definition\n\nFor now, some general todos:\n- align on a pattern what to set as `type`\n- add `type` and `handled` to every captureException call where they're currently missing\n- update develop docs with better wording/examples and that SDKs should always set these properties\n","author":{"url":"https://github.com/Lms24","@type":"Person","name":"Lms24"},"datePublished":"2025-07-29T13:46:42Z","url":"https://github.com/getsentry/sentry-javascript/issues/17212"}
| react-profiling | 0 |
| react-import-map | react,react-dom,react-dom/client,react-dom/profiling,react-is,react/compiler-runtime,react/jsx-dev-runtime,react/jsx-runtime,scheduler@b8488ee2c322 |
| route-pattern | /_view_fragments/issues/show/:user_id/:repository/:id/issue_layout(.:format) |
| route-controller | voltron_issues_fragments |
| route-action | issue_layout |
| fetch-nonce | v2:e28130ab-c975-7bd2-e8f0-3202ccc4e872 |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | EA20:3714B8:9FC845:DBDD3B:6B0452BE |
| html-safe-nonce | f403f2a36a0c5ec9a7a3e2f001615bda87104815334ce6b7a97a05453169cd89 |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJFQTIwOjM3MTRCODo5RkM4NDU6REJERDNCOjZCMDQ1MkJFIiwidmlzaXRvcl9pZCI6IjU0ODExODU4ODQyNTY4ODMzOTAiLCJyZWdpb25fZWRnZSI6ImlhZCIsInJlZ2lvbl9yZW5kZXIiOiJpYWQifQ== |
| visitor-hmac | 6abd982b5f2a8b67ff33cc0e935a12f6fa3cc17bd7b8431d931017b3fb329159 |
| hovercard-subject-tag | issue:3273721661 |
| github-keyboard-shortcuts | repository,issues,copilot |
| google-site-verification | Apib7-x98H0j5cPqHWwSMm6dNU4GmODRoqxLiDzdx9I |
| octolytics-url | https://collector.github.com/github/collect |
| analytics-location | / |
| fb:app_id | 1401488693436528 |
| apple-itunes-app | app-id=1477376905, app-argument=https://github.com/_view_fragments/issues/show/getsentry/sentry-javascript/17212/issue_layout |
| twitter:image | https://opengraph.githubassets.com/c231354a6825d14261090e6b51642b7e7e1c6dbdb5848d1fcfbf00ce5049c79b/getsentry/sentry-javascript/issues/17212 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/c231354a6825d14261090e6b51642b7e7e1c6dbdb5848d1fcfbf00ce5049c79b/getsentry/sentry-javascript/issues/17212 |
| og:image:alt | Description When Sentry SDKs capture errors (e.g. via captureException), they include a mechanism field on the captured exception(s). Among other metadata, the mechanism most importantly contains t... |
| og:image:width | 1200 |
| og:image:height | 600 |
| og:site_name | GitHub |
| og:type | object |
| og:author:username | Lms24 |
| hostname | github.com |
| expected-hostname | github.com |
| None | 910ca0e260cfec6aff11407d8dc6a0d3a4cd381a2ec9ada56627b063426892a0 |
| turbo-cache-control | no-preview |
| go-import | github.com/getsentry/sentry-javascript git https://github.com/getsentry/sentry-javascript.git |
| octolytics-dimension-user_id | 1396951 |
| octolytics-dimension-user_login | getsentry |
| octolytics-dimension-repository_id | 3328572 |
| octolytics-dimension-repository_nwo | getsentry/sentry-javascript |
| octolytics-dimension-repository_public | true |
| octolytics-dimension-repository_is_fork | false |
| octolytics-dimension-repository_network_root_id | 3328572 |
| octolytics-dimension-repository_network_root_nwo | getsentry/sentry-javascript |
| turbo-body-classes | logged-out env-production page-responsive |
| disable-turbo | false |
| browser-stats-url | https://api.github.com/_private/browser/stats |
| browser-errors-url | https://api.github.com/_private/browser/errors |
| release | e086f9b7e88322eb2b41885a6ad425b215737fa5 |
| ui-target | full |
| theme-color | #1e2327 |
| color-scheme | light dark |
| react-app-name | issues |
Links:
| Server | github.com |
| Content-Type | text/html; charset=utf-8 |
| Cache-Control | max-age=0, private, must-revalidate |
Viewport: width=device-width