-
Notifications
You must be signed in to change notification settings - Fork 4
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[BUG] Error cause
not being respected
#17
Comments
For anyone else who gets this, here's a workaround: just extend the class, so you can use the protected import {BrowserMicroSentryClient as Base} from '@micro-sentry/browser'
class BrowserMicroSentryClient extends Base {
report(error: Error) {
const prepared = this.prepare(error)
prepared.extra ||= {}
prepared.extra.cause ||= error.cause
Object.assign(prepared.extra, error)
this.send(prepared)
}
} (the Object.assign adds anything else hanging off the Error object - what the official Sentry client does too) |
Could you open pull request? |
I opened #18 with the workaround we're using, but it probably isn't up to scratch/mergeable - I haven't looked into docs/tests etc. But feel free to push to that branch - I don't think I'll be able to dive in any time soon sadly. |
Thanks! I've made a comment on the PR. TL;DR: |
🐞 Bug report
Description
We are calling
Sentry.report(new Error('Something bad happened'), {cause: 'Some useful context about the bad thing'})
on a micro-sentry client, but we only see the "Something bad happened" message in sentry.io. I would expect the cause to appear under the "extras" section in the Sentry UI. It's not in the JSON payload sent to sentry a all thoughReproduction
I don't know that it's possible to reproduce in stackblitz since it's about what gets sent to sentry, but it should be easy to reproduce if you have a local sentry set up. Just create a new
@micro-sentry/browser
client and call the code snippet above.Expected behavior
Include
cause
(MDN docs)Versions
If needed:
Additional context
The text was updated successfully, but these errors were encountered: