Title: Handle `SuppressedError` · Issue #8441 · getsentry/sentry-javascript · GitHub
Open Graph Title: Handle `SuppressedError` · Issue #8441 · getsentry/sentry-javascript
X Title: Handle `SuppressedError` · Issue #8441 · getsentry/sentry-javascript
Description: Problem Statement Explicit Resource Management has reached TC39 stage 3: https://github.com/tc39/proposal-explicit-resource-management Support has been added to TypeScript 5.2 beta: https://devblogs.microsoft.com/typescript/announcing-ty...
Open Graph Description: Problem Statement Explicit Resource Management has reached TC39 stage 3: https://github.com/tc39/proposal-explicit-resource-management Support has been added to TypeScript 5.2 beta: https://devblog...
X Description: Problem Statement Explicit Resource Management has reached TC39 stage 3: https://github.com/tc39/proposal-explicit-resource-management Support has been added to TypeScript 5.2 beta: https://devblog...
Opengraph URL: https://github.com/getsentry/sentry-javascript/issues/8441
X: @github
Domain: github.com
IPv4 address: 140.82.113.3
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"Handle `SuppressedError`","articleBody":"### Problem Statement\n\nExplicit Resource Management has reached TC39 stage 3:\n[https://github.com/tc39/proposal-explicit-resource-management](\u003chttps://github.com/tc39/proposal-explicit-resource-management>)\n\nSupport has been added to TypeScript 5.2 beta:\n[https://devblogs.microsoft.com/typescript/announcing-typescript-5-2-beta/#using-declarations-and-explicit-resource-management](\u003chttps://devblogs.microsoft.com/typescript/announcing-typescript-5-2-beta/#using-declarations-and-explicit-resource-management>)\n\nWhen this makes it into browsers/node.js/platforms, there will be a new error type called [`SuppressedError`](\u003chttps://github.com/tc39/proposal-explicit-resource-management#the-suppressederror-error>) which wraps any exception thrown and also any exception thrown during resource disposal.\n\nReporting `SuppressedError` directly to Sentry will likely be not that useful so the error(s) should be pulled out.\n\n```ts\nclass SuppressedError extends Error {\n /**\n * Wraps an error that suppresses another error, and the error that was suppressed.\n * @param {*} error The error that resulted in a suppression.\n * @param {*} suppressed The error that was suppressed.\n * @param {string} message The message for the error.\n * @param {{ cause?: * }} [options] Options for the error.\n */\n constructor(error, suppressed, message, options);\n\n /**\n * The name of the error (i.e., `\"SuppressedError\"`).\n * @type {string}\n */\n name = \"SuppressedError\";\n\n /**\n * The error that resulted in a suppression.\n * @type {*}\n */\n error;\n\n /**\n * The error that was suppressed.\n * @type {*}\n */\n suppressed;\n\n /**\n * The message for the error.\n * @type {*}\n */\n message;\n}\n```\n\nThe TypeScript introduction gives a good example of how these properties are populated:\n\n```ts\nclass ErrorA extends Error {\n name = \"ErrorA\";\n}\nclass ErrorB extends Error {\n name = \"ErrorB\";\n}\n\nfunction throwy(id: string) {\n return {\n [Symbol.dispose]() {\n throw new ErrorA(`Error from ${id}`);\n }\n };\n}\n\nfunction func() {\n using a = throwy(\"a\");\n throw new ErrorB(\"oops!\")\n}\n\ntry {\n func();\n}\ncatch (e: any) {\n console.log(e.name); // SuppressedError\n console.log(e.message); // An error was suppressed during disposal.\n\n console.log(e.error.name); // ErrorA\n console.log(e.error.message); // Error from a\n\n console.log(e.suppressed.name); // ErrorB\n console.log(e.suppressed.message); // oops!\n}\n```","author":{"url":"https://github.com/timfish","@type":"Person","name":"timfish"},"datePublished":"2023-07-01T20:23:24Z","url":"https://github.com/getsentry/sentry-javascript/issues/8441"}
| 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:dd7f5bce-efcc-7d02-4147-d3e11d292a9a |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | 849E:28DCA8:DA912:1319D8:6B041569 |
| html-safe-nonce | e2465496f0ddbff0e2fd41d9147d585214eb307636a1b91fe253121cd7362d08 |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiI4NDlFOjI4RENBODpEQTkxMjoxMzE5RDg6NkIwNDE1NjkiLCJ2aXNpdG9yX2lkIjoiODM4MzkyNzY0NzA4Mzk1OTY1NyIsInJlZ2lvbl9lZGdlIjoiaWFkIiwicmVnaW9uX3JlbmRlciI6ImlhZCJ9 |
| visitor-hmac | 16c79f9dbce2879f1edb347b9c1821820e56099cb9a2cae6074132e4c340ab89 |
| hovercard-subject-tag | issue:1784203779 |
| 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/8441/issue_layout |
| twitter:image | https://opengraph.githubassets.com/fe3e0abaa6bfb8ea82dceecbcc72f18ab2914f197d8d379200c6ab7226f82184/getsentry/sentry-javascript/issues/8441 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/fe3e0abaa6bfb8ea82dceecbcc72f18ab2914f197d8d379200c6ab7226f82184/getsentry/sentry-javascript/issues/8441 |
| og:image:alt | Problem Statement Explicit Resource Management has reached TC39 stage 3: https://github.com/tc39/proposal-explicit-resource-management Support has been added to TypeScript 5.2 beta: https://devblog... |
| og:image:width | 1200 |
| og:image:height | 600 |
| og:site_name | GitHub |
| og:type | object |
| og:author:username | timfish |
| hostname | github.com |
| expected-hostname | github.com |
| None | 87e774ee7c6b3bee0490394e4d3e57ec9dbc956f74b87ea685dc8996c1676456 |
| 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 | 423dbb54c5e7bfecc838eb387c1435eb3d0e760d |
| 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