Skip to content

Commit 52c4af0

Browse files
committed
fix tests
this makes me mad that this is a thing
1 parent 00cc3c8 commit 52c4af0

File tree

1 file changed

+6
-3
lines changed

1 file changed

+6
-3
lines changed

packages/browser/src/integrations/globalhandlers.ts

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -55,9 +55,6 @@ export class GlobalHandlers implements Integration {
5555
Error.stackTraceLimit = 50;
5656

5757
const hub = getCurrentHub();
58-
if (!hub.getIntegration(GlobalHandlers)) {
59-
return;
60-
}
6158
const client = hub.getClient();
6259
const attachStacktrace = client && client.getOptions().attachStacktrace;
6360

@@ -80,6 +77,9 @@ function _installGlobalOnErrorHandler(hub: Hub, attachStacktrace: boolean | unde
8077
addInstrumentationHandler({
8178
// eslint-disable-next-line @typescript-eslint/no-explicit-any
8279
callback: (data: { msg: any; url: any; line: any; column: any; error: any }) => {
80+
if (!hub.getIntegration(GlobalHandlers)) {
81+
return;
82+
}
8383
const error = data.error;
8484
const isFailedOwnDelivery = error && error.__sentry_own_request__ === true;
8585

@@ -111,6 +111,9 @@ function _installGlobalOnUnhandledRejectionHandler(hub: Hub, attachStacktrace: b
111111
addInstrumentationHandler({
112112
// eslint-disable-next-line @typescript-eslint/no-explicit-any
113113
callback: (e: any) => {
114+
if (!hub.getIntegration(GlobalHandlers)) {
115+
return;
116+
}
114117
let error = e;
115118

116119
// dig the object of the rejection out of known event types

0 commit comments

Comments
 (0)