You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Before submitting a pull request, please take a look at our
[Contributing](https://github.com/getsentry/sentry-javascript/blob/master/CONTRIBUTING.md)
guidelines and verify:
- [x] If you've added code that should be tested, please add tests.
- [x] Ensure your code lints and the test suite passes (`yarn lint`) &
(`yarn test`).
---
closes#15142
When using `ExtraErrorDataIntegration`, `error.cause` serializes with
`.toString()` which is not very informative considering the purpose of
the integration.
This PR improves `error.cause` handling in `ExtraErrorDataIntegration`
by recursing the `_extractErrorData` for a single cause depth. To match
the outer structure and provide more information the cause object is
wrapped with `[name]`.
The `.toString()` serialized data is gone now but if we are using
`LinkedErrorsIntegration` the string message will still be visible.
Since these changes are useful enough, I think more detailed
specifications (like cause recursion) could be addressed by future PRs -
open to suggestions.
**Before:**
```javascript
// error.cause was serialized as: "SyntaxError: bar"
{
TypeError: {
cause: "SyntaxError: bar" // Just toString() output
}
}
```
**After:**
```javascript
// error.cause now includes full error data extraction
{
TypeError: {
cause: {
SyntaxError: {
baz: 42,
foo: "aaaa...a...",
}
}
}
}
```
0 commit comments