-
-
Notifications
You must be signed in to change notification settings - Fork 1.7k
Closed
Labels
Meta: Help WantedPackage: browserIssues related to the Sentry Browser SDKIssues related to the Sentry Browser SDK
Description
Package + Version
-
@sentry/browser -
@sentry/node -
raven-js -
raven-node(raven for node) - other:
Version:
6.13.3
Description
This is related to #3119
When calling captureException with a DOMException the stack trace of the error is lost.
The code at line 76 of eventbuilder.ts currently has a comment:
if (isDOMError(exception as DOMError) || isDOMException(exception as DOMException)) {
// If it is a DOMError or DOMException (which are legacy APIs, but still supported in some browsers)
// then we just extract the name, code, and message, as they don't provide anything else
// https://developer.mozilla.org/en-US/docs/Web/API/DOMError
// https://developer.mozilla.org/en-US/docs/Web/API/DOMException
...Which I believe is incorrect. DOMError is a legacy API but I don't believe DOMException is. According to 3.14.1. DOMException custom bindings it is expected that DOMException should be an instance of Error and have an associated stack trace. I have confirmed that this is the case in current versions of Safari/Edge/Firefox/Chrome. This is not the case in IE11 though.
I am happy to submit a PR to fix this issue but wanted to get some guidance first.
The fixes I've considered so far are:
- Remove the
isDOMExceptioncheck from the above line, but this will not catchDOMExceptions in IE11 (or any other platform where they're not instances ofError). - Move the
if (isError(exception as Error))block before the other checks and remove thecase '[object DOMException]':fromisError. However I'm not sure where elseisErroris used or what the expected behaviour of this function is. - Change the condition on line 76 from
... || isDOMException(exception as DOMException)to... || (isDOMException(exception as DOMException) && !isInstanceOf(exception, Error)).
Metadata
Metadata
Assignees
Labels
Meta: Help WantedPackage: browserIssues related to the Sentry Browser SDKIssues related to the Sentry Browser SDK