-
-
Notifications
You must be signed in to change notification settings - Fork 1.7k
Closed
Labels
Package: nodeIssues related to the Sentry Node SDKIssues related to the Sentry Node SDK
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/getsentry/sentry-javascript/releases
How do you use Sentry?
Sentry Saas (sentry.io)
Which SDK are you using?
@sentry/node
SDK Version
7.64.0
Framework Version
No response
Link to Sentry event
No response
SDK Setup
No response
Steps to Reproduce
const Sentry = require('@sentry/node');
Sentry.init({ dsn: 'https://[email protected]/123' });
throw new Error('foo', { cause: 'bar' });
Expected Result
The printed error should include the cause
.
Actual Result
The printed error does not include the cause
:
$ node test.js
Error: foo
at Object.<anonymous> (/Users/oliver/Code/unsplash/unsplash-web/test.js:4:7)
at Module._compile (node:internal/modules/cjs/loader:1254:14)
at Module._extensions..js (node:internal/modules/cjs/loader:1308:10)
at Module.load (node:internal/modules/cjs/loader:1117:32)
at Module._load (node:internal/modules/cjs/loader:958:12)
at Function.executeUserEntryPoint [as runMain] (node:internal/modules/run_main:81:12)
at node:internal/main/run_main_module:23:47
If we remove Sentry.init
, the cause
is shown:
$ node test.js
/Users/oliver/Code/unsplash/unsplash-web/test.js:4
throw new Error('foo', { cause: 'bar' });
^
Error: foo
at Object.<anonymous> (/Users/oliver/Code/unsplash/unsplash-web/test.js:4:7)
at Module._compile (node:internal/modules/cjs/loader:1254:14)
at Module._extensions..js (node:internal/modules/cjs/loader:1308:10)
at Module.load (node:internal/modules/cjs/loader:1117:32)
at Module._load (node:internal/modules/cjs/loader:958:12)
at Function.executeUserEntryPoint [as runMain] (node:internal/modules/run_main:81:12)
at node:internal/main/run_main_module:23:47 {
[cause]: 'bar'
}
It seems that Sentry is changing the way that exceptions are printed. I believe this custom logic needs to be updated to include the cause
. Furthermore, I am wondering if it's possible to disable this and use Node's default behaviour?
Metadata
Metadata
Assignees
Labels
Package: nodeIssues related to the Sentry Node SDKIssues related to the Sentry Node SDK
Type
Projects
Status
No status