Skip to content
Merged
Show file tree
Hide file tree
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: 6 additions & 0 deletions MIGRATION.md
Original file line number Diff line number Diff line change
Expand Up @@ -567,6 +567,12 @@ Sentry.init({
});
```

### `DOMException.code` is no longer set as a tag

Affected SDKs: All SDKs running in the browser.

Events created from a `DOMException` no longer carry a `DOMException.code` tag. The `code` property is deprecated and has been replaced by `DOMException.name`, which is already available as the exception type. If you have searches or alert rules keyed on the tag, switch them to `error.type`.

### `attachStacktrace` defaults to `true`

Affected SDKs: All SDKs.
Expand Down
4 changes: 0 additions & 4 deletions packages/browser/src/eventbuilder.ts
Original file line number Diff line number Diff line change
Expand Up @@ -302,10 +302,6 @@ export function eventFromUnknownInput(
event = eventFromString(stackParser, message, syntheticException, attachStacktrace);
addExceptionTypeValue(event, message);
}
if ('code' in domException) {
// eslint-disable-next-line typescript/no-deprecated
event.tags = { ...event.tags, 'DOMException.code': `${domException.code}` };
}

return event;
}
Expand Down
9 changes: 9 additions & 0 deletions packages/browser/test/eventbuilder.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -294,6 +294,15 @@ describe('eventFromUnknownInput', () => {
}),
);
});

it('does not set the deprecated DOMException.code as an event tag', () => {
const exception = new DOMException('Permission denied', 'NotAllowedError');

const event = eventFromUnknownInput(defaultStackParser, exception);

expect(event.exception?.values?.[0]?.type).toBe('NotAllowedError');
expect(event.tags).toBeUndefined();
});
});

describe('extractMessage', () => {
Expand Down
Loading