sentry-javascript icon indicating copy to clipboard operation
sentry-javascript copied to clipboard

Track DOMException.name instead of DOMException.code

Open behnam-oneschema opened this issue 1 year ago • 1 comments

Problem Statement

DOMException.code is a deprecated feature. Reference: https://developer.mozilla.org/en-US/docs/Web/API/DOMException

The codes are also hardly practical, considering only the numeric value of them is shown in the Sentry UI: image

Solution Brainstorm

DOMException.name is the current best-practice in identifying these errors, and is supported widely across browsers:

image

behnam-oneschema avatar Feb 05 '24 18:02 behnam-oneschema

Hey @behnam-oneschema, this is something we might do for our v8 version (https://github.com/getsentry/sentry-javascript/issues/9508), adding it to our milestone!

AbhiPrasad avatar Feb 06 '24 17:02 AbhiPrasad

So taking another look at this - shouldn't DOMException.name show up as the error type? Which you can search for via error.type.

AbhiPrasad avatar Feb 21 '24 13:02 AbhiPrasad

Yeah, indeed it looks like DOMException.name is being indexed already as error.type. Although, It's not shown on the error details page, in contrast to DOMException.code.

behnam-oneschema avatar Feb 22 '24 03:02 behnam-oneschema

@behnam-oneschema right. We are setting code as a tag on the event. This is why it shows up in that heatmap on the issues page.

Having this as a tag makes very little sense, as all the errors that are grouped together likely have the same tag value. We should some sort of context instead probably. (Side-note: having type as a tag would equally not make any sense for the same reason)

@AbhiPrasad I think the TODO for us here is to move this into a context or data field.

lforst avatar Feb 23 '24 11:02 lforst