Skip to content
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

fix(browser): Don't special case DOMExceptions that are also Errors #4156

Closed
wants to merge 1 commit into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 5 additions & 1 deletion packages/browser/src/eventbuilder.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ import {
isError,
isErrorEvent,
isEvent,
isInstanceOf,
isPlainObject,
SyncPromise,
} from '@sentry/utils';
Expand Down Expand Up @@ -73,7 +74,10 @@ export function eventFromUnknownInput(
event = eventFromStacktrace(computeStackTrace(exception as Error));
return event;
}
if (isDOMError(exception as DOMError) || isDOMException(exception as DOMException)) {
if (
isDOMError(exception as DOMError) ||
(isDOMException(exception as DOMException) && !isInstanceOf(exception, Error))
) {
// 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
Expand Down