Skip to content

Commit 42d8bbe

Browse files
committed
guard reason
1 parent 9c7d6fc commit 42d8bbe

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

packages/node-core/src/integrations/onunhandledrejection.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,8 @@ export function makeUnhandledPromiseHandler(
5353

5454
// this can be set in places where we cannot reliably get access to the active span/error
5555
// when the error bubbles up to this handler, we can use this to set the active span
56-
const activeSpanForError = (reason as { _sentry_active_span?: Span })._sentry_active_span;
56+
const activeSpanForError =
57+
reason && typeof reason === 'object' ? (reason as { _sentry_active_span?: Span })._sentry_active_span : undefined;
5758

5859
const activeSpanWrapper = activeSpanForError
5960
? (fn: () => void) => withActiveSpan(activeSpanForError, fn)

0 commit comments

Comments
 (0)