Skip to content

Commit aca120c

Browse files
committed
fix: Check for anonymous function before getting its name for mechanism
1 parent a83da58 commit aca120c

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

packages/browser/src/integrations/trycatch.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,7 @@ export class TryCatch implements Integration {
6969
mechanism: {
7070
data: {
7171
function: 'handleEvent',
72-
handler: ((fn as any) as SentryWrappedFunction).name || '<anonymous>',
72+
handler: (fn && ((fn as any) as SentryWrappedFunction).name) || '<anonymous>',
7373
target,
7474
},
7575
handled: true,
@@ -124,7 +124,7 @@ export class TryCatch implements Integration {
124124
mechanism: {
125125
data: {
126126
function: 'addEventListener',
127-
handler: ((fn as any) as SentryWrappedFunction).name || '<anonymous>',
127+
handler: (fn && ((fn as any) as SentryWrappedFunction).name) || '<anonymous>',
128128
target,
129129
},
130130
handled: true,

0 commit comments

Comments
 (0)