sentry-javascript: Error message property logged as [object ErrorEvent]
Do you want to request a feature or report a bug? Bug.
What is the current behavior?
Sometimes (not always) the message property of the error is logged as [object ErrorEvent]. I followed the standard implementation of Raven in Angular as described here: https://docs.sentry.io/clients/javascript/integrations/angular/.
What is the expected behavior? To see a normal error message.
Raven 3.17.0 Angular 4.3.1 Webpack build Not using CLI CDN version

About this issue
- Original URL
- State: closed
- Created 7 years ago
- Reactions: 10
- Comments: 31 (17 by maintainers)
Hi, I am getting a lot of these errors
[object Object].Angular 4 Chrome 62.0.3202 Raven-js 3.20.1
I found the issue.
ErrorEventis not being treated as an error by theisErrorutil function, which can be found here. For convenience, I’ll paste the function definition also:I did a quick test in my console to see whether or not this function would return true for an
ErrorEvent, and it did not:isErroris used in thecaptureExceptionmethod to determine whether the exception parameter is an error or simply a message.captureExceptionwill send exceptions to the dashboard usingcaptureMessageif it thinks the exception is not actually an error. In this case, Raven will not compute a stack trace or “process” the exception. It just sends it off as is.Is there any reason we shouldn’t update
isErrorto return true forErrorEventobjects?^ This in your html is logged in safari via sentry as
[object ErrorEvent]. Correct message would have beenTypeError: undefined is not an object (evaluating 'undefined.foo').We have an external script that injects code via script tag that tries to create an iframe, but thats blocked by safari. As the error originates from the injected script tag, sentry just reports
[object ErrorEvent]It looks like traceKitWindowOnError doesn’t process correctly input parameters when ‘message’ parameter is an ErrorEvent object:
and ‘ex’ is undefined. Then, it invokes notifyHandlers with an object where ‘message’ field is an ErrorEvent, not string:
which, when strigified in _makeRequest, produces meaningless message.
I understand. I’ll put up a PR in a few minutes.
Sure, I believe this can be solved – I just meant that it is not as simple as just augmenting
isErrorto returntrue.Another error from sentry reported as just
[object Event]is from the flowplayer. The flowplayer doesYou can reproduce it by embedding jQuery and just do:
Sentry sees something like this
Sure thats not very serializable, but an error like
error on element from jQuery - context <div class="foo><div class="bar" ...would be much more helpful then[object Event]