8000 fix(core): Ensure `ignoreErrors` only applies to error events (#7573) · GingerAdonis/sentry-javascript@0a1a567 · GitHub
[go: up one dir, main page]

Skip to content

Commit 0a1a567

Browse files
authored
fix(core): Ensure ignoreErrors only applies to error events (getsentry#7573)
1 parent 551aedc commit 0a1a567

File tree

2 files changed

+14
-1
lines changed

2 files changed

+14
-1
lines changed

packages/core/src/integrations/inboundfilters.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -103,7 +103,8 @@ export function _shouldDropEvent(event: Event, options: Partial<InboundFiltersOp
103103
}
104104

105105
function _isIgnoredError(event: Event, ignoreErrors?: Array<string | RegExp>): boolean {
106-
if (!ignoreErrors || !ignoreErrors.length) {
106+
// If event.type, this is not an error
107+
if (event.type || !ignoreErrors || !ignoreErrors.length) {
107108
return false;
108109
}
109110

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

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

180+
const TRANSACTION_EVENT: Event = {
181+
message: 'transaction message',
182+
type: 'transaction',
183+
};
184+
180185
describe('InboundFilters', () => {
181186
describe('_isSentryError', () => {
182187
it('should work as expected', () => {
@@ -202,6 +207,13 @@ describe('InboundFilters', () => {
202207
expect(eventProcessor(MESSAGE_EVENT, {})).toBe(null);
203208
});
204209

210+
it('ignores transaction event for filtering', () => {
211+
const eventProcessor = createInboundFiltersEventProcessor({
212+
ignoreErrors: ['transaction'],
213+
});
214+
expect(eventProcessor(TRANSACTION_EVENT, {})).toBe(TRANSACTION_EVENT);
215+
});
216+
205217
it('string filter with exact match', () => {
206218
const eventProcessor = createInboundFiltersEventProcessor({
207219
ignoreErrors: ['captureMessage'],

0 commit comments

Comments
 (0)
0