Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
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
5 changes: 3 additions & 2 deletions packages/core/src/integrations/third-party-errors-filter.ts
Original file line number Diff line number Diff line change
Expand Up @@ -108,8 +108,9 @@ function getBundleKeysForAllFramesWithFilenames(event: Event): string[][] | unde

return (
frames
// Exclude frames without a filename since these are likely native code or built-ins
.filter(frame => !!frame.filename)
// Exclude frames without a filename or without lineno and colno,
// since these are likely native code or built-ins
.filter(frame => !!frame.filename && (frame.lineno != null || frame.colno != null))
.map(frame => {
if (frame.module_metadata) {
return Object.keys(frame.module_metadata)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,19 @@ const eventWithThirdAndFirstPartyFrames: Event = {
function: 'function',
lineno: 2,
},
// The following frames are native/built-in frames which should be ignored by the integration
{
function: 'Array.forEach',
filename: '<anonymous>',
abs_path: '<anonymous>',
in_app: true,
},
{
function: 'async Promise.all',
filename: 'index 1',
abs_path: 'index 1',
in_app: true,
},
],
},
type: 'SyntaxError',
Expand Down Expand Up @@ -59,6 +72,19 @@ const eventWithOnlyFirstPartyFrames: Event = {
function: 'function',
lineno: 2,
},
// The following frames are native/built-in frames which should be ignored by the integration
{
function: 'Array.forEach',
filename: '<anonymous>',
abs_path: '<anonymous>',
in_app: true,
},
{
function: 'async Promise.all',
filename: 'index 1',
abs_path: 'index 1',
in_app: true,
},
],
},
type: 'SyntaxError',
Expand Down Expand Up @@ -86,6 +112,19 @@ const eventWithOnlyThirdPartyFrames: Event = {
function: 'function',
lineno: 2,
},
// The following frames are native/built-in frames which should be ignored by the integration
{
function: 'Array.forEach',
filename: '<anonymous>',
abs_path: '<anonymous>',
in_app: true,
},
{
function: 'async Promise.all',
filename: 'index 1',
abs_path: 'index 1',
in_app: true,
},
],
},
type: 'SyntaxError',
Expand All @@ -112,7 +151,7 @@ describe('ThirdPartyErrorFilter', () => {
});

describe('drop-error-if-contains-third-party-frames', () => {
it('should keep event if there are exclusively first-party frames', async () => {
it('keeps event if there are exclusively first-party frames', async () => {
const integration = thirdPartyErrorFilterIntegration({
behaviour: 'drop-error-if-contains-third-party-frames',
filterKeys: ['some-key'],
Expand All @@ -123,7 +162,7 @@ describe('ThirdPartyErrorFilter', () => {
expect(result).toBeDefined();
});

it('should drop event if there is at least one third-party frame', async () => {
it('drops event if there is at least one third-party frame', async () => {
const integration = thirdPartyErrorFilterIntegration({
behaviour: 'drop-error-if-contains-third-party-frames',
filterKeys: ['some-key'],
Expand All @@ -134,7 +173,7 @@ describe('ThirdPartyErrorFilter', () => {
expect(result).toBe(null);
});

it('should drop event if all frames are third-party frames', async () => {
it('drops event if all frames are third-party frames', async () => {
const integration = thirdPartyErrorFilterIntegration({
behaviour: 'drop-error-if-contains-third-party-frames',
filterKeys: ['some-key'],
Expand All @@ -147,7 +186,7 @@ describe('ThirdPartyErrorFilter', () => {
});

describe('drop-error-if-exclusively-contains-third-party-frames', () => {
it('should keep event if there are exclusively first-party frames', async () => {
it('keeps event if there are exclusively first-party frames', async () => {
const integration = thirdPartyErrorFilterIntegration({
behaviour: 'drop-error-if-exclusively-contains-third-party-frames',
filterKeys: ['some-key'],
Expand All @@ -158,7 +197,7 @@ describe('ThirdPartyErrorFilter', () => {
expect(result).toBeDefined();
});

it('should keep event if there is at least one first-party frame', async () => {
it('keeps event if there is at least one first-party frame', async () => {
const integration = thirdPartyErrorFilterIntegration({
behaviour: 'drop-error-if-exclusively-contains-third-party-frames',
filterKeys: ['some-key'],
Expand All @@ -169,7 +208,7 @@ describe('ThirdPartyErrorFilter', () => {
expect(result).toBeDefined();
});

it('should drop event if all frames are third-party frames', async () => {
it('drops event if all frames are third-party frames', async () => {
const integration = thirdPartyErrorFilterIntegration({
behaviour: 'drop-error-if-exclusively-contains-third-party-frames',
filterKeys: ['some-key'],
Expand All @@ -182,7 +221,7 @@ describe('ThirdPartyErrorFilter', () => {
});

describe('apply-tag-if-contains-third-party-frames', () => {
it('should not tag event if exclusively contains first-party frames', async () => {
it("doesn't tag event if exclusively contains first-party frames", async () => {
const integration = thirdPartyErrorFilterIntegration({
behaviour: 'apply-tag-if-contains-third-party-frames',
filterKeys: ['some-key'],
Expand All @@ -193,7 +232,7 @@ describe('ThirdPartyErrorFilter', () => {
expect(result?.tags?.third_party_code).toBeUndefined();
});

it('should tag event if contains at least one third-party frame', async () => {
it('tags event if contains at least one third-party frame', async () => {
const integration = thirdPartyErrorFilterIntegration({
behaviour: 'apply-tag-if-contains-third-party-frames',
filterKeys: ['some-key'],
Expand All @@ -204,7 +243,7 @@ describe('ThirdPartyErrorFilter', () => {
expect(result?.tags).toMatchObject({ third_party_code: true });
});

it('should tag event if contains exclusively third-party frames', async () => {
it('tags event if contains exclusively third-party frames', async () => {
const integration = thirdPartyErrorFilterIntegration({
behaviour: 'apply-tag-if-contains-third-party-frames',
filterKeys: ['some-key'],
Expand All @@ -217,7 +256,7 @@ describe('ThirdPartyErrorFilter', () => {
});

describe('apply-tag-if-exclusively-contains-third-party-frames', () => {
it('should not tag event if exclusively contains first-party frames', async () => {
it("doesn't tag event if exclusively contains first-party frames", async () => {
const integration = thirdPartyErrorFilterIntegration({
behaviour: 'apply-tag-if-exclusively-contains-third-party-frames',
filterKeys: ['some-key'],
Expand All @@ -228,7 +267,7 @@ describe('ThirdPartyErrorFilter', () => {
expect(result?.tags?.third_party_code).toBeUndefined();
});

it('should not tag event if contains at least one first-party frame', async () => {
it("doesn't tag event if contains at least one first-party frame", async () => {
const integration = thirdPartyErrorFilterIntegration({
behaviour: 'apply-tag-if-exclusively-contains-third-party-frames',
filterKeys: ['some-key'],
Expand All @@ -239,7 +278,7 @@ describe('ThirdPartyErrorFilter', () => {
expect(result?.tags?.third_party_code).toBeUndefined();
});

it('should tag event if contains exclusively third-party frames', async () => {
it('tags event if contains exclusively third-party frames', async () => {
const integration = thirdPartyErrorFilterIntegration({
behaviour: 'apply-tag-if-exclusively-contains-third-party-frames',
filterKeys: ['some-key'],
Expand Down