Skip to content

Very uninformative onunhandledrejection errors when rejecting with Event #2210

@rchl

Description

@rchl

Package + Version

  • @sentry/browser
  • @sentry/node
  • raven-js
  • raven-node (raven for node)
  • other:

Version:

5.6.2

Description

Errors captured through onunhandledrejection mechanism never really provide any useful information that would help in figuring out the problem.

In my app, I have thousands (17K as of now for one of them, after few months) of UnhandledRejection errors. All info that those events provide is just a an error text like UnhandledRejection: "CustomEvent" (note that with latest version of Sentry it became a little bit more informative with UnhandledRejection: Non-Error promise rejection captured with keys: isTrusted text). There is no stack nor extra context and those errors happen on routes and paths that work perfectly for me and everyone I know so I'm unable figure out how to address them.

Now, I assume, that the problem is only with unhandled promise rejections that reject with non-Error type like primitive values (string, null, etc.) or (like in this case) an Event object. While I don't see how to improve cases with primitive values, I think for event objects, more data could be logged.

It seems the UnhandledRejection: Non-Error promise rejection captured with keys: isTrusted message comes from the fact that isTrusted is the only iterable key on the event object (try console.log(Object.keys(new CustomEvent('test')))). But event objects have more useful (non-iterable) keys that could provide more information about the error. Namely I'm thinking about detail and type properties. I think those could help identifying from which code event is coming from.

So I'm suggesting to add some custom code (if there isn't already) for handling that special case (unhandledrejection with event object) better.

Some example events:
https://sentry.io/share/issue/4d294f75e9704103b7c3b49e62b6e278/
https://sentry.io/share/issue/c36904ab4c224fbda6f1afff63c106ee/
(these are minimal, sharable versions but full events don't really provide any other meaningful information either.)

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions