From 2a490a5015bdc28116323d39901f1594fde528e5 Mon Sep 17 00:00:00 2001 From: Abhijeet Prasad Date: Tue, 3 Aug 2021 08:51:41 -0400 Subject: [PATCH] fix(browser): Make sure handler exists for LinkedErrors Integration We should port the fixes done in the Node SDK in https://github.com/getsentry/sentry-javascript/pull/2742 to the browser SDK. This makes sure that the handler class method is defined in the linked errors integration. --- packages/browser/src/integrations/linkederrors.ts | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/packages/browser/src/integrations/linkederrors.ts b/packages/browser/src/integrations/linkederrors.ts index 627559789866..dad3b2759fa9 100644 --- a/packages/browser/src/integrations/linkederrors.ts +++ b/packages/browser/src/integrations/linkederrors.ts @@ -45,7 +45,8 @@ export class LinkedErrors implements Integration { addGlobalEventProcessor((event: Event, hint?: EventHint) => { const self = getCurrentHub().getIntegration(LinkedErrors); if (self) { - return self._handler(event, hint); + const handler = self._handler && self._handler.bind(self); + return typeof handler === 'function' ? handler(event, hint) : event; } return event; });