-
-
Notifications
You must be signed in to change notification settings - Fork 1.6k
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
Printed errors should show cause #8856
Comments
Hi @OliverJAsh thanks for writing in! I took a look at this and can confirm that we're not showing the cause (or fwiw any other properties of an error), in case the error has a stack trace. First of all, the Node SDK registers a handler for We try to emulate this default behaviour by explicitly logging the error to the console but for some reason, we only log the stack trace if the error has one (as in your example), meaning, we omit other error properties, such as
I tried tracking down why we're doing this but couldn't find an explanation other than that we seemed to have added it when we moved from I'll open a PR to just always log the entire |
FYI, the |
In our `OnUncaughtException` integration, we have to emulate Node's default behaviour of logging errors to the console. For some reason though, we only logged the stack trace of an `error` with a stack trace instead of the entire error object. As reported in #8856, this causes additional properties on the error (such as `cause`) not to be logged anymore which doesn't reflect Node's default behaviour (see issue for comparison). This patch simplifies the `console.error` call to just always log the entire `error`.
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
7.64.0
Framework Version
No response
Link to Sentry event
No response
SDK Setup
No response
Steps to Reproduce
Expected Result
The printed error should include the
cause
.Actual Result
The printed error does not include the
cause
:If we remove
Sentry.init
, thecause
is shown: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?The text was updated successfully, but these errors were encountered: