Is there an existing issue for this?
How do you use Sentry?
Sentry Saas (sentry.io)
Which SDK are you using?
@sentry/node
SDK Version
9.11.0
Framework Version
@sentry/electron 6.5.0
Link to Sentry event
No response
Reproduction Example/SDK Setup
initSentry({
beforeSend(event, hint) {
// Seems unintuitive - I'd expect rejection reason here
const test = hint.originalException instanceof Promise; // true
return event;
},
});
Steps to Reproduce
- Throw an error from an async function and do not catch it - global
"unhandledRejection" Sentry handler should capture it
beforeSend is invoked - inspect EventHint.originalException to find its a Promise object. Was expecting rejection reason.
See source code:
|
originalException: promise, |
Expected Result
I expected rejection reason (e.g. the thrown error object) inside EventHint.originalException, not a Promise object. I figured I can do the following:
let originalException;
if (hint.originalException instanceof Promise) {
try {
await hint.originalException;
} catch (e) {
originalException = e;
}
}
But this feels dirty - what am I supposed to do with the Promise object?
Actual Result
See above.
Additional Context
No response
Priority
React with 👍 to help prioritize this issue. Please use comments to provide useful context, avoiding +1 or me too, to help us triage it.
Is there an existing issue for this?
How do you use Sentry?
Sentry Saas (sentry.io)
Which SDK are you using?
@sentry/node
SDK Version
9.11.0
Framework Version
@sentry/electron 6.5.0
Link to Sentry event
No response
Reproduction Example/SDK Setup
Steps to Reproduce
"unhandledRejection"Sentry handler should capture itbeforeSendis invoked - inspectEventHint.originalExceptionto find its aPromiseobject. Was expecting rejection reason.See source code:
sentry-javascript/packages/node-core/src/integrations/onunhandledrejection.ts
Line 112 in 73d51f2
Expected Result
I expected rejection reason (e.g. the thrown error object) inside
EventHint.originalException, not a Promise object. I figured I can do the following:But this feels dirty - what am I supposed to do with the Promise object?
Actual Result
See above.
Additional Context
No response
Priority
React with 👍 to help prioritize this issue. Please use comments to provide useful context, avoiding
+1orme too, to help us triage it.