Title: The ExtraErrorData integration is not capturing nested error causes · Issue #15142 · getsentry/sentry-javascript · GitHub
Open Graph Title: The ExtraErrorData integration is not capturing nested error causes · Issue #15142 · getsentry/sentry-javascript
X Title: The ExtraErrorData integration is not capturing nested error causes · Issue #15142 · getsentry/sentry-javascript
Description: Is there an existing issue for this? I have checked for existing issues https://github.com/getsentry/sentry-javascript/issues I have reviewed the documentation https://docs.sentry.io/ I am using the latest SDK release https://github.com/...
Open Graph Description: Is there an existing issue for this? I have checked for existing issues https://github.com/getsentry/sentry-javascript/issues I have reviewed the documentation https://docs.sentry.io/ I am using th...
X Description: Is there an existing issue for this? I have checked for existing issues https://github.com/getsentry/sentry-javascript/issues I have reviewed the documentation https://docs.sentry.io/ I am using th...
Opengraph URL: https://github.com/getsentry/sentry-javascript/issues/15142
X: @github
Domain: github.com
IPv4 address: 140.82.112.3
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"The ExtraErrorData integration is not capturing nested error causes","articleBody":"### Is there an existing issue for this?\n\n- [x] I have checked for existing issues https://github.com/getsentry/sentry-javascript/issues\n- [x] I have reviewed the documentation https://docs.sentry.io/\n- [x] I am using the latest SDK release https://github.com/getsentry/sentry-javascript/releases\n\n### How do you use Sentry?\n\nSentry Saas (sentry.io)\n\n### Which SDK are you using?\n\n@sentry/nextjs\n\n### SDK Version\n\n8.51.0\n\n### Framework Version\n\nNext 15.1.3\n\n### Link to Sentry event\n\nhttps://sally-and-friends.sentry.io/issues/6215894150/events/2b86efb54ff54674bac3bd0582bc1952/\n\n### Reproduction Example/SDK Setup\n\n// sentry.server.config (same for the other two)\n```ts\nSentry.init({\n integrations: [\n Sentry.extraErrorDataIntegration({\n depth: 15,\n }),\n ],\n normalizeDepth: 15,\n});\n```\n\n// my custom error class' toJSON\n```ts\nexport class CustomError extends Error {\n // ... tell me if you need the whole class. But the point is, that this.cause is returned inside `toJSON`\n\n toJSON(): Record\u003cstring, unknown> {\n return {\n message: this.message,\n name: this.name,\n cause: this.cause,\n };\n }\n}\n```\n\n### Steps to Reproduce\n\n1. Set up a custom error class that has a `toJSON` method, which includes the `this.cause` property.\n2. Throw an error which has such error in its `cause`. E.g.\n ```ts\n throw new TRPCError(\"Top-level error\", {\n cause: new CustomError(\"Nested error\", {\n foo: \"bar\"\n })\n })\n ```\n\n### Expected Result\n\nThe top-level error is getting serialized, including the extra error data.\nThe `cause` field is another structured error data. E.g.\n\n```ts\n{\n message: \"Nested error\",\n name: \"Custom Error\",\n cause: {foo: \"bar\"},\n}\n```\nbecause capturing the `cause` is enabled by default.\n\n### Actual Result\n\nThe nested error getting serialized in the format `${errorClassName}: ${message} instead of the whole structured data.\n\n","author":{"url":"https://github.com/michaelschufi","@type":"Person","name":"michaelschufi"},"datePublished":"2025-01-23T08:36:13Z","url":"https://github.com/getsentry/sentry-javascript/issues/15142"}
| 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:847570a0-fe18-724d-5f7b-26d882ac1960 |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | 9C24:2303A6:1D8B482:28B7A23:6B059F62 |
| html-safe-nonce | a640797fa7d6210d570b7d83b4d842814e6fc561d4cc294884bd0ceef139b46e |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiI5QzI0OjIzMDNBNjoxRDhCNDgyOjI4QjdBMjM6NkIwNTlGNjIiLCJ2aXNpdG9yX2lkIjoiNzE4ODc1NzU5Mjg2MzUxNDQ2NiIsInJlZ2lvbl9lZGdlIjoiaWFkIiwicmVnaW9uX3JlbmRlciI6ImlhZCJ9 |
| visitor-hmac | 46d16b26d886c14d37a6597a48445ee1d687bddf53ddb64c0673978967acee36 |
| hovercard-subject-tag | issue:2806262943 |
| 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/15142/issue_layout |
| twitter:image | https://opengraph.githubassets.com/89f7591c2fe1d92c075b41ca93d251399324195a348280c9eebf5bd79bdebb92/getsentry/sentry-javascript/issues/15142 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/89f7591c2fe1d92c075b41ca93d251399324195a348280c9eebf5bd79bdebb92/getsentry/sentry-javascript/issues/15142 |
| og:image:alt | Is there an existing issue for this? I have checked for existing issues https://github.com/getsentry/sentry-javascript/issues I have reviewed the documentation https://docs.sentry.io/ I am using th... |
| og:image:width | 1200 |
| og:image:height | 600 |
| og:site_name | GitHub |
| og:type | object |
| og:author:username | michaelschufi |
| hostname | github.com |
| expected-hostname | github.com |
| None | 8bd54b96ae4db60ce608a145a6b2fb16216749fbdb431d9879aabfa7459f1139 |
| 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 | cda4791073b4da3005eb3d470dc0aef3956bbe34 |
| 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