Skip to content

Commit a2b7e3c

Browse files
committed
feat: Ignore ResizeObserver and undefined error
1 parent 695b2b0 commit a2b7e3c

File tree

2 files changed

+34
-1
lines changed

2 files changed

+34
-1
lines changed

packages/core/src/integrations/inboundfilters.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ import { convertIntegrationFnToClass, defineIntegration } from '../integration';
66

77
// "Script error." is hard coded into browsers for errors that it can't read.
88
// this is the result of a script being pulled in from an external domain and CORS.
9-
const DEFAULT_IGNORE_ERRORS = [/^Script error\.?$/, /^Javascript error: Script error\.? on line 0$/];
9+
const DEFAULT_IGNORE_ERRORS = [/^Script error\.?$/, /^Javascript error: Script error\.? on line 0$/, /^ResizeObserver loop completed with undelivered notifications.$/, /^undefined$/];
1010

1111
/** Options for the InboundFilters integration */
1212
export interface InboundFiltersOptions {

packages/core/test/lib/integrations/inboundfilters.test.ts

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -177,6 +177,18 @@ const SENTRY_EVENT: Event = {
177177
},
178178
};
179179

180+
const BOGUS_EVENT: Event = {
181+
message: '',
182+
exception: {
183+
values: [
184+
{
185+
type: 'Error',
186+
value: 'undefined',
187+
},
188+
],
189+
},
190+
};
191+
180192
const SCRIPT_ERROR_EVENT: Event = {
181193
exception: {
182194
values: [
@@ -188,6 +200,17 @@ const SCRIPT_ERROR_EVENT: Event = {
188200
},
189201
};
190202

203+
const RESIZEOBSERVER_EVENT: Event = {
204+
exception: {
205+
values: [
206+
{
207+
type: 'Error',
208+
value: 'ResizeObserver loop completed with undelivered notifications.',
209+
},
210+
],
211+
},
212+
};
213+
191214
const MALFORMED_EVENT: Event = {
192215
exception: {
193216
values: [
@@ -294,6 +317,16 @@ describe('InboundFilters', () => {
294317
expect(eventProcessor(SCRIPT_ERROR_EVENT, {})).toBe(null);
295318
});
296319

320+
it('uses default filters Resize', () => {
321+
const eventProcessor = createInboundFiltersEventProcessor();
322+
expect(eventProcessor(RESIZEOBSERVER_EVENT, {})).toBe(null);
323+
});
324+
325+
it('uses default filters Empty', () => {
326+
const eventProcessor = createInboundFiltersEventProcessor();
327+
expect(eventProcessor(BOGUS_EVENT, {})).toBe(null);
328+
});
329+
297330
it('filters on last exception when multiple present', () => {
298331
const eventProcessor = createInboundFiltersEventProcessor({
299332
ignoreErrors: ['incorrect type given for parameter `chewToy`'],

0 commit comments

Comments
 (0)