sentry-javascript: Non-Error exception captured with keys: currentTarget, isTrusted, target, type
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 Browser CDN bundle
SDK Version
latest
Framework Version
jquery@2.2
Link to Sentry event
https://workstream-is.sentry.io/issues/4086742434/?project=6108198&referrer=jira_integration
SDK Setup
Sentry.init({
release: "#{env.SENTRY_RELEASE}",
});
Steps to Reproduce
No we cannot reproduce it.
Expected Result
No event object should be thrown as error
Actual Result
Weird empty event object is thrown
About this issue
- Original URL
- State: closed
- Created a year ago
- Comments: 18 (9 by maintainers)
FYI, we have just merged a PR that, while not fully addressing the issues outlined here, should at least help a bit with clearing this up: https://github.com/getsentry/sentry-javascript/pull/8374
With this PR, the error messages should at least be clearer. When an Event is captured by
captureException, it will better show what kind of event it is, and if it is an ErrorEvent, it will also show the error message.What this does not address is why sometimes there is no stack track. TBH I am not quite sure why this is happening, as for non-error exception we should be using a syntethic exception to get some stack trace at least. So this remains open for investigation š¤
Hey. š I was able to debug when this problem occurs. In a situation where āErrorEvent: ResizeObserver loop limit exceededā occurs, the event in method ābeforeSendā appears as āErrorEvent: Non-Error exception captured with keys: currentTarget, isTrusted, target, typeā. This may lead to a fix for the problem.
Version: 7.51.2
Interestingly, it worked fine in older versions:
Version: 5.30.0
Not sure what is going on here, especially since itās happening in all browsers.
Basically this occurs because something is running
throw eventin an event listener, and because this is not being an error thrown we canāt get a stacktrace at all.Perhaps we should just filter these server side tbh.
Hi @SunStupic thanks for writing in!
Unfortunately, I canāt really tell you either where this error is coming from. You mentioned #6199 already and I also think that this is related. Maybe it is also some script that failed to load. Just that it errored instead of throwing a promise rejection. Itās very hard for us to diagnose these issues without a reproduction. Happy to look into it if thereās a way to reproduce this.
If you you donāt want to see this issue, I suggest you use
beforeSendto filter it out:I sent you an email (got your email from your website, hope itās the correct one)!