@honeybadger-io/js 6.4.2 → 6.5.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/browser/honeybadger.js +12 -8
- package/dist/browser/honeybadger.js.map +1 -1
- package/dist/browser/honeybadger.min.js +1 -1
- package/dist/browser/honeybadger.min.js.map +1 -1
- package/dist/server/honeybadger.js +58 -43
- package/dist/server/honeybadger.js.map +1 -1
- package/dist/server/integrations/unhandled_rejection_monitor.d.ts +6 -2
- package/package.json +3 -3
|
@@ -864,14 +864,14 @@ var NOT_BLANK = /\S/;
|
|
|
864
864
|
var Client = /** @class */ (function () {
|
|
865
865
|
function Client(opts, transport) {
|
|
866
866
|
if (opts === void 0) { opts = {}; }
|
|
867
|
-
this.
|
|
867
|
+
this.__pluginsLoaded = false;
|
|
868
868
|
this.__store = null;
|
|
869
869
|
this.__beforeNotifyHandlers = [];
|
|
870
870
|
this.__afterNotifyHandlers = [];
|
|
871
871
|
this.__notifier = {
|
|
872
872
|
name: '@honeybadger-io/core',
|
|
873
873
|
url: 'https://github.com/honeybadger-io/honeybadger-js/tree/master/packages/core',
|
|
874
|
-
version: '6.
|
|
874
|
+
version: '6.5.0'
|
|
875
875
|
};
|
|
876
876
|
this.config = __assign({ apiKey: null, endpoint: 'https://api.honeybadger.io', environment: null, hostname: null, projectRoot: null, component: null, action: null, revision: null, reportData: null, breadcrumbsEnabled: true, maxBreadcrumbs: 40, maxObjectDepth: 8, logger: console, developmentEnvironments: ['dev', 'development', 'test'], debug: false, tags: null, enableUncaught: true, enableUnhandledRejection: true, afterUncaught: function () { return true; }, filters: ['creditcard', 'password'], __plugins: [] }, opts);
|
|
877
877
|
this.__initStore();
|
|
@@ -895,17 +895,21 @@ var Client = /** @class */ (function () {
|
|
|
895
895
|
this.__notifier = notifier;
|
|
896
896
|
};
|
|
897
897
|
Client.prototype.configure = function (opts) {
|
|
898
|
-
var _this = this;
|
|
899
898
|
if (opts === void 0) { opts = {}; }
|
|
900
899
|
for (var k in opts) {
|
|
901
900
|
this.config[k] = opts[k];
|
|
902
901
|
}
|
|
903
|
-
|
|
904
|
-
this.__pluginsExecuted = true;
|
|
905
|
-
this.config.__plugins.forEach(function (plugin) { return plugin.load(_this); });
|
|
906
|
-
}
|
|
902
|
+
this.loadPlugins();
|
|
907
903
|
return this;
|
|
908
904
|
};
|
|
905
|
+
Client.prototype.loadPlugins = function () {
|
|
906
|
+
var _this = this;
|
|
907
|
+
var pluginsToLoad = this.__pluginsLoaded
|
|
908
|
+
? this.config.__plugins.filter(function (plugin) { return plugin.shouldReloadOnConfigure; })
|
|
909
|
+
: this.config.__plugins;
|
|
910
|
+
pluginsToLoad.forEach(function (plugin) { return plugin.load(_this); });
|
|
911
|
+
this.__pluginsLoaded = true;
|
|
912
|
+
};
|
|
909
913
|
Client.prototype.__initStore = function () {
|
|
910
914
|
this.__store = new store_1.GlobalStore({ context: {}, breadcrumbs: [] }, this.config.maxBreadcrumbs);
|
|
911
915
|
};
|
|
@@ -1520,13 +1524,6 @@ var UncaughtExceptionMonitor = /** @class */ (function () {
|
|
|
1520
1524
|
if (_this.__isReporting || !_this.__client) {
|
|
1521
1525
|
return;
|
|
1522
1526
|
}
|
|
1523
|
-
if (!_this.__client.config.enableUncaught) {
|
|
1524
|
-
_this.__client.config.afterUncaught(uncaughtError);
|
|
1525
|
-
if (!_this.hasOtherUncaughtExceptionListeners()) {
|
|
1526
|
-
(0, util_1$2.fatallyLogAndExit)(uncaughtError);
|
|
1527
|
-
}
|
|
1528
|
-
return;
|
|
1529
|
-
}
|
|
1530
1527
|
// report only the first error - prevent reporting recursive errors
|
|
1531
1528
|
if (_this.__handlerAlreadyCalled) {
|
|
1532
1529
|
if (!_this.hasOtherUncaughtExceptionListeners()) {
|
|
@@ -1603,7 +1600,8 @@ function default_1$1() {
|
|
|
1603
1600
|
else {
|
|
1604
1601
|
uncaughtExceptionMonitor.maybeRemoveListener();
|
|
1605
1602
|
}
|
|
1606
|
-
}
|
|
1603
|
+
},
|
|
1604
|
+
shouldReloadOnConfigure: true,
|
|
1607
1605
|
};
|
|
1608
1606
|
}
|
|
1609
1607
|
uncaught_exception_plugin.default = default_1$1;
|
|
@@ -1615,10 +1613,40 @@ var unhandled_rejection_monitor = {};
|
|
|
1615
1613
|
Object.defineProperty(unhandled_rejection_monitor, "__esModule", { value: true });
|
|
1616
1614
|
var util_1$1 = util;
|
|
1617
1615
|
var UnhandledRejectionMonitor = /** @class */ (function () {
|
|
1618
|
-
function UnhandledRejectionMonitor(
|
|
1616
|
+
function UnhandledRejectionMonitor() {
|
|
1619
1617
|
this.__isReporting = false;
|
|
1620
|
-
this.
|
|
1618
|
+
this.__listener = this.makeListener();
|
|
1621
1619
|
}
|
|
1620
|
+
UnhandledRejectionMonitor.prototype.setClient = function (client) {
|
|
1621
|
+
this.__client = client;
|
|
1622
|
+
};
|
|
1623
|
+
UnhandledRejectionMonitor.prototype.makeListener = function () {
|
|
1624
|
+
var _this = this;
|
|
1625
|
+
var honeybadgerUnhandledRejectionListener = function (reason, _promise) {
|
|
1626
|
+
_this.__isReporting = true;
|
|
1627
|
+
_this.__client.notify(reason, { component: 'unhandledRejection' }, {
|
|
1628
|
+
afterNotify: function () {
|
|
1629
|
+
_this.__isReporting = false;
|
|
1630
|
+
if (!_this.hasOtherUnhandledRejectionListeners()) {
|
|
1631
|
+
(0, util_1$1.fatallyLogAndExit)(reason);
|
|
1632
|
+
}
|
|
1633
|
+
}
|
|
1634
|
+
});
|
|
1635
|
+
};
|
|
1636
|
+
return honeybadgerUnhandledRejectionListener;
|
|
1637
|
+
};
|
|
1638
|
+
UnhandledRejectionMonitor.prototype.maybeAddListener = function () {
|
|
1639
|
+
var listeners = process.listeners('unhandledRejection');
|
|
1640
|
+
if (!listeners.includes(this.__listener)) {
|
|
1641
|
+
process.on('unhandledRejection', this.__listener);
|
|
1642
|
+
}
|
|
1643
|
+
};
|
|
1644
|
+
UnhandledRejectionMonitor.prototype.maybeRemoveListener = function () {
|
|
1645
|
+
var listeners = process.listeners('unhandledRejection');
|
|
1646
|
+
if (listeners.includes(this.__listener)) {
|
|
1647
|
+
process.removeListener('unhandledRejection', this.__listener);
|
|
1648
|
+
}
|
|
1649
|
+
};
|
|
1622
1650
|
/**
|
|
1623
1651
|
* If there are no other unhandledRejection listeners,
|
|
1624
1652
|
* we want to report the exception to Honeybadger and
|
|
@@ -1626,25 +1654,10 @@ var UnhandledRejectionMonitor = /** @class */ (function () {
|
|
|
1626
1654
|
* which is to exit the process with code 1
|
|
1627
1655
|
*/
|
|
1628
1656
|
UnhandledRejectionMonitor.prototype.hasOtherUnhandledRejectionListeners = function () {
|
|
1629
|
-
return process.listeners('unhandledRejection').length > 1;
|
|
1630
|
-
};
|
|
1631
|
-
UnhandledRejectionMonitor.prototype.handleUnhandledRejection = function (reason, _promise) {
|
|
1632
1657
|
var _this = this;
|
|
1633
|
-
|
|
1634
|
-
|
|
1635
|
-
|
|
1636
|
-
}
|
|
1637
|
-
return;
|
|
1638
|
-
}
|
|
1639
|
-
this.__isReporting = true;
|
|
1640
|
-
this.__client.notify(reason, { component: 'unhandledRejection' }, {
|
|
1641
|
-
afterNotify: function () {
|
|
1642
|
-
_this.__isReporting = false;
|
|
1643
|
-
if (!_this.hasOtherUnhandledRejectionListeners()) {
|
|
1644
|
-
(0, util_1$1.fatallyLogAndExit)(reason);
|
|
1645
|
-
}
|
|
1646
|
-
}
|
|
1647
|
-
});
|
|
1658
|
+
var otherListeners = process.listeners('unhandledRejection')
|
|
1659
|
+
.filter(function (listener) { return listener !== _this.__listener; });
|
|
1660
|
+
return otherListeners.length > 0;
|
|
1648
1661
|
};
|
|
1649
1662
|
return UnhandledRejectionMonitor;
|
|
1650
1663
|
}());
|
|
@@ -1655,17 +1668,19 @@ var __importDefault$2 = (commonjsGlobal && commonjsGlobal.__importDefault) || fu
|
|
|
1655
1668
|
};
|
|
1656
1669
|
Object.defineProperty(unhandled_rejection_plugin, "__esModule", { value: true });
|
|
1657
1670
|
var unhandled_rejection_monitor_1 = __importDefault$2(unhandled_rejection_monitor);
|
|
1671
|
+
var unhandledRejectionMonitor = new unhandled_rejection_monitor_1.default();
|
|
1658
1672
|
function default_1() {
|
|
1659
1673
|
return {
|
|
1660
1674
|
load: function (client) {
|
|
1661
|
-
|
|
1662
|
-
|
|
1675
|
+
unhandledRejectionMonitor.setClient(client);
|
|
1676
|
+
if (client.config.enableUnhandledRejection) {
|
|
1677
|
+
unhandledRejectionMonitor.maybeAddListener();
|
|
1663
1678
|
}
|
|
1664
|
-
|
|
1665
|
-
|
|
1666
|
-
|
|
1667
|
-
|
|
1668
|
-
|
|
1679
|
+
else {
|
|
1680
|
+
unhandledRejectionMonitor.maybeRemoveListener();
|
|
1681
|
+
}
|
|
1682
|
+
},
|
|
1683
|
+
shouldReloadOnConfigure: true,
|
|
1669
1684
|
};
|
|
1670
1685
|
}
|
|
1671
1686
|
unhandled_rejection_plugin.default = default_1;
|
|
@@ -2054,7 +2069,7 @@ stacked_store.StackedStore = StackedStore;
|
|
|
2054
2069
|
var NOTIFIER = {
|
|
2055
2070
|
name: '@honeybadger-io/js',
|
|
2056
2071
|
url: 'https://github.com/honeybadger-io/honeybadger-js/tree/master/packages/js',
|
|
2057
|
-
version: '6.
|
|
2072
|
+
version: '6.5.0'
|
|
2058
2073
|
};
|
|
2059
2074
|
singleton.setNotifier(NOTIFIER);
|
|
2060
2075
|
var core_2 = src;
|