From fc02f0081ef7b888064589c332caf5b15c92dce8 Mon Sep 17 00:00:00 2001 From: Ben Wilson Date: Thu, 29 Aug 2024 09:34:06 +0100 Subject: [PATCH] fix clientContext.getStore() calls --- packages/node/src/notifier.js | 2 +- packages/plugin-node-uncaught-exception/uncaught-exception.js | 2 +- packages/plugin-node-unhandled-rejection/unhandled-rejection.js | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/packages/node/src/notifier.js b/packages/node/src/notifier.js index 6c1f5d4691..a4a1a51496 100644 --- a/packages/node/src/notifier.js +++ b/packages/node/src/notifier.js @@ -103,7 +103,7 @@ Object.keys(Client.prototype).forEach((m) => { Bugsnag[m] = function () { // if we are in an async context, use the client from that context let client = Bugsnag._client - if (client && client._clientContext && typeof client._clientContext.getStore === 'function') { + if (client && client._clientContext && client._clientContext.getStore()) { client = client._clientContext.getStore() } diff --git a/packages/plugin-node-uncaught-exception/uncaught-exception.js b/packages/plugin-node-uncaught-exception/uncaught-exception.js index 31ed2fa290..7e90fc0198 100644 --- a/packages/plugin-node-uncaught-exception/uncaught-exception.js +++ b/packages/plugin-node-uncaught-exception/uncaught-exception.js @@ -7,7 +7,7 @@ module.exports = { if (!client._config.enabledErrorTypes.unhandledExceptions) return _handler = err => { // if we are in an async context, use the client from that context - const c = (client._clientContext && typeof client._clientContext.getStore === 'function') ? client._clientContext.getStore() : client + const c = (client._clientContext && client._clientContext.getStore()) ? client._clientContext.getStore() : client // check if the stacktrace has no context, if so append the frames we created earlier // see plugin-contextualize for where this is created diff --git a/packages/plugin-node-unhandled-rejection/unhandled-rejection.js b/packages/plugin-node-unhandled-rejection/unhandled-rejection.js index 23ddd37ac9..43e9340d8d 100644 --- a/packages/plugin-node-unhandled-rejection/unhandled-rejection.js +++ b/packages/plugin-node-unhandled-rejection/unhandled-rejection.js @@ -4,7 +4,7 @@ module.exports = { if (!client._config.autoDetectErrors || !client._config.enabledErrorTypes.unhandledRejections) return _handler = err => { // if we are in an async context, use the client from that context - const c = (client._clientContext && typeof client._clientContext.getStore === 'function') ? client._clientContext.getStore() : client + const c = (client._clientContext && client._clientContext.getStore()) ? client._clientContext.getStore() : client const event = c.Event.create(err, false, { severity: 'error',