@honeybadger-io/js 6.10.1 → 6.11.1
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.ext.min.js +1 -1
- package/dist/browser/honeybadger.ext.min.js.map +1 -1
- package/dist/browser/honeybadger.js +50 -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/check-ins-sync.js +8 -3
- package/dist/server/check-ins-sync.js.map +1 -1
- package/dist/server/honeybadger.js +262 -81
- package/dist/server/honeybadger.js.map +1 -1
- package/dist/server/integrations/shutdown_monitor.d.ts +15 -0
- package/dist/server/integrations/shutdown_plugin.d.ts +3 -0
- package/dist/server/util.d.ts +3 -1
- package/package.json +4 -4
|
@@ -408,7 +408,7 @@ var require$$0$1 = /*@__PURE__*/getAugmentedNamespace(stackTraceParser_esm);
|
|
|
408
408
|
return [4 /*yield*/, getSourceFileHandler(trace.file)];
|
|
409
409
|
case 2:
|
|
410
410
|
fileContent = _a.sent();
|
|
411
|
-
result[index] = getSourceCodeSnippet(fileContent, trace.number);
|
|
411
|
+
result[index] = getSourceCodeSnippet(fileContent, trace.number, trace.column, 2);
|
|
412
412
|
index++;
|
|
413
413
|
return [3 /*break*/, 1];
|
|
414
414
|
case 3: return [2 /*return*/, result];
|
|
@@ -776,14 +776,34 @@ var require$$0$1 = /*@__PURE__*/getAugmentedNamespace(stackTraceParser_esm);
|
|
|
776
776
|
return JSON.parse(JSON.stringify(obj));
|
|
777
777
|
}
|
|
778
778
|
exports.clone = clone;
|
|
779
|
-
|
|
779
|
+
var THRESHOLD_COLUMN_NUMBER = 10000;
|
|
780
|
+
var THRESHOLD_LINE_LENGTH = 10000;
|
|
781
|
+
var THRESHOLD_FILE_SIZE = 200000; // 200KB threshold
|
|
782
|
+
function getThresholdExceededSnippet(lineNumber) {
|
|
783
|
+
var _a;
|
|
784
|
+
return _a = {}, _a[lineNumber] = 'SOURCE_SIZE_TOO_LARGE', _a;
|
|
785
|
+
}
|
|
786
|
+
function getSourceCodeSnippet(fileData, lineNumber, columnNumber, sourceRadius) {
|
|
780
787
|
if (sourceRadius === void 0) { sourceRadius = 2; }
|
|
781
788
|
if (!fileData) {
|
|
782
789
|
return null;
|
|
783
790
|
}
|
|
791
|
+
// If column number is provided and very high, it's likely a bundled/minified file
|
|
792
|
+
if (columnNumber && columnNumber > THRESHOLD_COLUMN_NUMBER) {
|
|
793
|
+
return getThresholdExceededSnippet(lineNumber);
|
|
794
|
+
}
|
|
795
|
+
// If file is very large, it's likely bundled
|
|
796
|
+
if (fileData.length > THRESHOLD_FILE_SIZE) {
|
|
797
|
+
return getThresholdExceededSnippet(lineNumber);
|
|
798
|
+
}
|
|
784
799
|
var lines = fileData.split('\n');
|
|
785
800
|
// add one empty line because array index starts from 0, but error line number is counted from 1
|
|
786
801
|
lines.unshift('');
|
|
802
|
+
// Check if the target line is extremely long
|
|
803
|
+
var targetLine = lines[lineNumber];
|
|
804
|
+
if (targetLine && targetLine.length > THRESHOLD_LINE_LENGTH) {
|
|
805
|
+
return getThresholdExceededSnippet(lineNumber);
|
|
806
|
+
}
|
|
787
807
|
var start = lineNumber - sourceRadius;
|
|
788
808
|
var end = lineNumber + sourceRadius;
|
|
789
809
|
var result = {};
|
|
@@ -835,9 +855,9 @@ var require$$0$1 = /*@__PURE__*/getAugmentedNamespace(stackTraceParser_esm);
|
|
|
835
855
|
} (util$1));
|
|
836
856
|
|
|
837
857
|
Object.defineProperty(events, "__esModule", { value: true });
|
|
838
|
-
var util_1$
|
|
839
|
-
function default_1$
|
|
840
|
-
if (_window === void 0) { _window = (0, util_1$
|
|
858
|
+
var util_1$8 = util$1;
|
|
859
|
+
function default_1$3(_window) {
|
|
860
|
+
if (_window === void 0) { _window = (0, util_1$8.globalThisOrWindow)(); }
|
|
841
861
|
return {
|
|
842
862
|
shouldReloadOnConfigure: false,
|
|
843
863
|
load: function (client) {
|
|
@@ -847,7 +867,7 @@ function default_1$2(_window) {
|
|
|
847
867
|
if (!sendEventsToInsights()) {
|
|
848
868
|
return;
|
|
849
869
|
}
|
|
850
|
-
(0, util_1$
|
|
870
|
+
(0, util_1$8.instrumentConsole)(_window, function (level, args) {
|
|
851
871
|
if (!sendEventsToInsights()) {
|
|
852
872
|
return;
|
|
853
873
|
}
|
|
@@ -869,7 +889,7 @@ function default_1$2(_window) {
|
|
|
869
889
|
}
|
|
870
890
|
};
|
|
871
891
|
}
|
|
872
|
-
events.default = default_1$
|
|
892
|
+
events.default = default_1$3;
|
|
873
893
|
|
|
874
894
|
var client$1 = {};
|
|
875
895
|
|
|
@@ -877,7 +897,7 @@ var store = {};
|
|
|
877
897
|
|
|
878
898
|
Object.defineProperty(store, "__esModule", { value: true });
|
|
879
899
|
store.GlobalStore = void 0;
|
|
880
|
-
var util_1$
|
|
900
|
+
var util_1$7 = util$1;
|
|
881
901
|
var GlobalStore = /** @class */ (function () {
|
|
882
902
|
function GlobalStore(contents, breadcrumbsLimit) {
|
|
883
903
|
this.contents = contents;
|
|
@@ -894,7 +914,7 @@ var GlobalStore = /** @class */ (function () {
|
|
|
894
914
|
return JSON.parse(JSON.stringify(value));
|
|
895
915
|
};
|
|
896
916
|
GlobalStore.prototype.setContext = function (context) {
|
|
897
|
-
this.contents.context = (0, util_1$
|
|
917
|
+
this.contents.context = (0, util_1$7.merge)(this.contents.context, context || {});
|
|
898
918
|
};
|
|
899
919
|
GlobalStore.prototype.addBreadcrumb = function (breadcrumb) {
|
|
900
920
|
if (this.contents.breadcrumbs.length == this.breadcrumbsLimit) {
|
|
@@ -973,7 +993,7 @@ var __assign$2 = (commonjsGlobal && commonjsGlobal.__assign) || function () {
|
|
|
973
993
|
};
|
|
974
994
|
return __assign$2.apply(this, arguments);
|
|
975
995
|
};
|
|
976
|
-
var __awaiter$
|
|
996
|
+
var __awaiter$4 = (commonjsGlobal && commonjsGlobal.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
977
997
|
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
978
998
|
return new (P || (P = Promise))(function (resolve, reject) {
|
|
979
999
|
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
@@ -982,7 +1002,7 @@ var __awaiter$3 = (commonjsGlobal && commonjsGlobal.__awaiter) || function (this
|
|
|
982
1002
|
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
983
1003
|
});
|
|
984
1004
|
};
|
|
985
|
-
var __generator$
|
|
1005
|
+
var __generator$4 = (commonjsGlobal && commonjsGlobal.__generator) || function (thisArg, body) {
|
|
986
1006
|
var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
|
|
987
1007
|
return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
|
|
988
1008
|
function verb(n) { return function (v) { return step([n, v]); }; }
|
|
@@ -1012,7 +1032,7 @@ var __generator$3 = (commonjsGlobal && commonjsGlobal.__generator) || function (
|
|
|
1012
1032
|
Object.defineProperty(throttled_events_logger, "__esModule", { value: true });
|
|
1013
1033
|
throttled_events_logger.ThrottledEventsLogger = void 0;
|
|
1014
1034
|
var json_nd_1 = require$$0;
|
|
1015
|
-
var util_1$
|
|
1035
|
+
var util_1$6 = util$1;
|
|
1016
1036
|
var defaults_1$1 = defaults;
|
|
1017
1037
|
var ThrottledEventsLogger = /** @class */ (function () {
|
|
1018
1038
|
function ThrottledEventsLogger(config, transport) {
|
|
@@ -1034,16 +1054,17 @@ var ThrottledEventsLogger = /** @class */ (function () {
|
|
|
1034
1054
|
this.processQueue();
|
|
1035
1055
|
}
|
|
1036
1056
|
};
|
|
1057
|
+
ThrottledEventsLogger.prototype.flushAsync = function () {
|
|
1058
|
+
this.logger.debug('[Honeybadger] Flushing events');
|
|
1059
|
+
return this.send();
|
|
1060
|
+
};
|
|
1037
1061
|
ThrottledEventsLogger.prototype.processQueue = function () {
|
|
1038
1062
|
var _this = this;
|
|
1039
1063
|
if (this.queue.length === 0 || this.isProcessing) {
|
|
1040
1064
|
return;
|
|
1041
1065
|
}
|
|
1042
1066
|
this.isProcessing = true;
|
|
1043
|
-
|
|
1044
|
-
this.queue = [];
|
|
1045
|
-
var data = json_nd_1.NdJson.stringify(eventsData);
|
|
1046
|
-
this.makeHttpRequest(data)
|
|
1067
|
+
this.send()
|
|
1047
1068
|
.then(function () {
|
|
1048
1069
|
setTimeout(function () {
|
|
1049
1070
|
_this.isProcessing = false;
|
|
@@ -1059,10 +1080,24 @@ var ThrottledEventsLogger = /** @class */ (function () {
|
|
|
1059
1080
|
}, 50);
|
|
1060
1081
|
});
|
|
1061
1082
|
};
|
|
1083
|
+
ThrottledEventsLogger.prototype.send = function () {
|
|
1084
|
+
return __awaiter$4(this, void 0, void 0, function () {
|
|
1085
|
+
var eventsData, data;
|
|
1086
|
+
return __generator$4(this, function (_a) {
|
|
1087
|
+
if (this.queue.length === 0) {
|
|
1088
|
+
return [2 /*return*/];
|
|
1089
|
+
}
|
|
1090
|
+
eventsData = this.queue.slice();
|
|
1091
|
+
this.queue = [];
|
|
1092
|
+
data = json_nd_1.NdJson.stringify(eventsData);
|
|
1093
|
+
return [2 /*return*/, this.makeHttpRequest(data)];
|
|
1094
|
+
});
|
|
1095
|
+
});
|
|
1096
|
+
};
|
|
1062
1097
|
ThrottledEventsLogger.prototype.makeHttpRequest = function (data) {
|
|
1063
|
-
return __awaiter$
|
|
1098
|
+
return __awaiter$4(this, void 0, void 0, function () {
|
|
1064
1099
|
var _this = this;
|
|
1065
|
-
return __generator$
|
|
1100
|
+
return __generator$4(this, function (_a) {
|
|
1066
1101
|
return [2 /*return*/, this.transport
|
|
1067
1102
|
.send({
|
|
1068
1103
|
headers: {
|
|
@@ -1070,7 +1105,7 @@ var ThrottledEventsLogger = /** @class */ (function () {
|
|
|
1070
1105
|
'Content-Type': 'application/json',
|
|
1071
1106
|
},
|
|
1072
1107
|
method: 'POST',
|
|
1073
|
-
endpoint: (0, util_1$
|
|
1108
|
+
endpoint: (0, util_1$6.endpoint)(this.config.endpoint, '/v1/events'),
|
|
1074
1109
|
maxObjectDepth: this.config.maxObjectDepth,
|
|
1075
1110
|
logger: this.logger,
|
|
1076
1111
|
}, data)
|
|
@@ -1122,7 +1157,7 @@ var __assign$1 = (commonjsGlobal && commonjsGlobal.__assign) || function () {
|
|
|
1122
1157
|
};
|
|
1123
1158
|
return __assign$1.apply(this, arguments);
|
|
1124
1159
|
};
|
|
1125
|
-
var __awaiter$
|
|
1160
|
+
var __awaiter$3 = (commonjsGlobal && commonjsGlobal.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
1126
1161
|
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
1127
1162
|
return new (P || (P = Promise))(function (resolve, reject) {
|
|
1128
1163
|
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
@@ -1131,7 +1166,7 @@ var __awaiter$2 = (commonjsGlobal && commonjsGlobal.__awaiter) || function (this
|
|
|
1131
1166
|
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
1132
1167
|
});
|
|
1133
1168
|
};
|
|
1134
|
-
var __generator$
|
|
1169
|
+
var __generator$3 = (commonjsGlobal && commonjsGlobal.__generator) || function (thisArg, body) {
|
|
1135
1170
|
var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
|
|
1136
1171
|
return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
|
|
1137
1172
|
function verb(n) { return function (v) { return step([n, v]); }; }
|
|
@@ -1160,7 +1195,7 @@ var __generator$2 = (commonjsGlobal && commonjsGlobal.__generator) || function (
|
|
|
1160
1195
|
};
|
|
1161
1196
|
Object.defineProperty(client$1, "__esModule", { value: true });
|
|
1162
1197
|
client$1.Client = void 0;
|
|
1163
|
-
var util_1$
|
|
1198
|
+
var util_1$5 = util$1;
|
|
1164
1199
|
var store_1 = store;
|
|
1165
1200
|
var throttled_events_logger_1 = throttled_events_logger;
|
|
1166
1201
|
var defaults_1 = defaults;
|
|
@@ -1178,13 +1213,13 @@ var Client = /** @class */ (function () {
|
|
|
1178
1213
|
this.__notifier = {
|
|
1179
1214
|
name: '@honeybadger-io/core',
|
|
1180
1215
|
url: 'https://github.com/honeybadger-io/honeybadger-js/tree/master/packages/core',
|
|
1181
|
-
version: '6.
|
|
1216
|
+
version: '6.11.1'
|
|
1182
1217
|
};
|
|
1183
1218
|
this.config = __assign$1(__assign$1({}, defaults_1.CONFIG), opts);
|
|
1184
1219
|
this.__initStore();
|
|
1185
1220
|
this.__transport = transport;
|
|
1186
1221
|
this.__eventsLogger = new throttled_events_logger_1.ThrottledEventsLogger(this.config, this.__transport);
|
|
1187
|
-
this.logger = (0, util_1$
|
|
1222
|
+
this.logger = (0, util_1$5.logger)(this);
|
|
1188
1223
|
}
|
|
1189
1224
|
Client.prototype.getVersion = function () {
|
|
1190
1225
|
return this.__notifier.version;
|
|
@@ -1255,16 +1290,16 @@ var Client = /** @class */ (function () {
|
|
|
1255
1290
|
var notice = this.makeNotice(noticeable, name, extra);
|
|
1256
1291
|
// we need to have the source file data before the beforeNotifyHandlers,
|
|
1257
1292
|
// in case they modify them
|
|
1258
|
-
var sourceCodeData = notice && notice.backtrace ? notice.backtrace.map(function (trace) { return (0, util_1$
|
|
1293
|
+
var sourceCodeData = notice && notice.backtrace ? notice.backtrace.map(function (trace) { return (0, util_1$5.shallowClone)(trace); }) : null;
|
|
1259
1294
|
var preConditionsResult = this.__runPreconditions(notice);
|
|
1260
1295
|
if (preConditionsResult instanceof Error) {
|
|
1261
|
-
(0, util_1$
|
|
1296
|
+
(0, util_1$5.runAfterNotifyHandlers)(notice, this.__afterNotifyHandlers, preConditionsResult);
|
|
1262
1297
|
return false;
|
|
1263
1298
|
}
|
|
1264
1299
|
if (preConditionsResult instanceof Promise) {
|
|
1265
1300
|
preConditionsResult.then(function (result) {
|
|
1266
1301
|
if (result instanceof Error) {
|
|
1267
|
-
(0, util_1$
|
|
1302
|
+
(0, util_1$5.runAfterNotifyHandlers)(notice, _this.__afterNotifyHandlers, result);
|
|
1268
1303
|
return false;
|
|
1269
1304
|
}
|
|
1270
1305
|
return _this.__send(notice, sourceCodeData);
|
|
@@ -1322,18 +1357,18 @@ var Client = /** @class */ (function () {
|
|
|
1322
1357
|
Client.prototype.makeNotice = function (noticeable, name, extra) {
|
|
1323
1358
|
if (name === void 0) { name = undefined; }
|
|
1324
1359
|
if (extra === void 0) { extra = undefined; }
|
|
1325
|
-
var notice = (0, util_1$
|
|
1360
|
+
var notice = (0, util_1$5.makeNotice)(noticeable);
|
|
1326
1361
|
if (name && !(typeof name === 'object')) {
|
|
1327
1362
|
var n = String(name);
|
|
1328
1363
|
name = { name: n };
|
|
1329
1364
|
}
|
|
1330
1365
|
if (name) {
|
|
1331
|
-
notice = (0, util_1$
|
|
1366
|
+
notice = (0, util_1$5.mergeNotice)(notice, name);
|
|
1332
1367
|
}
|
|
1333
1368
|
if (typeof extra === 'object' && extra !== null) {
|
|
1334
|
-
notice = (0, util_1$
|
|
1369
|
+
notice = (0, util_1$5.mergeNotice)(notice, extra);
|
|
1335
1370
|
}
|
|
1336
|
-
if ((0, util_1$
|
|
1371
|
+
if ((0, util_1$5.objectIsEmpty)(notice)) {
|
|
1337
1372
|
return null;
|
|
1338
1373
|
}
|
|
1339
1374
|
var context = this.__store.getContents('context');
|
|
@@ -1343,9 +1378,9 @@ var Client = /** @class */ (function () {
|
|
|
1343
1378
|
// Turning into a Set will remove duplicates
|
|
1344
1379
|
var tags = noticeTags.concat(contextTags).concat(configTags);
|
|
1345
1380
|
var uniqueTags = tags.filter(function (item, index) { return tags.indexOf(item) === index; });
|
|
1346
|
-
notice = (0, util_1$
|
|
1381
|
+
notice = (0, util_1$5.merge)(notice, {
|
|
1347
1382
|
name: notice.name || 'Error',
|
|
1348
|
-
context: (0, util_1$
|
|
1383
|
+
context: (0, util_1$5.merge)(context, notice.context),
|
|
1349
1384
|
projectRoot: notice.projectRoot || this.config.projectRoot,
|
|
1350
1385
|
environment: notice.environment || this.config.environment,
|
|
1351
1386
|
component: notice.component || this.config.component,
|
|
@@ -1357,11 +1392,11 @@ var Client = /** @class */ (function () {
|
|
|
1357
1392
|
// Otherwise we make one.
|
|
1358
1393
|
if (!Array.isArray(notice.backtrace) || !notice.backtrace.length) {
|
|
1359
1394
|
if (typeof notice.stack !== 'string' || !notice.stack.trim()) {
|
|
1360
|
-
notice.stack = (0, util_1$
|
|
1361
|
-
notice.backtrace = (0, util_1$
|
|
1395
|
+
notice.stack = (0, util_1$5.generateStackTrace)();
|
|
1396
|
+
notice.backtrace = (0, util_1$5.makeBacktrace)(notice.stack, true, this.logger);
|
|
1362
1397
|
}
|
|
1363
1398
|
else {
|
|
1364
|
-
notice.backtrace = (0, util_1$
|
|
1399
|
+
notice.backtrace = (0, util_1$5.makeBacktrace)(notice.stack, false, this.logger);
|
|
1365
1400
|
}
|
|
1366
1401
|
}
|
|
1367
1402
|
return notice;
|
|
@@ -1371,7 +1406,7 @@ var Client = /** @class */ (function () {
|
|
|
1371
1406
|
return;
|
|
1372
1407
|
}
|
|
1373
1408
|
opts = opts || {};
|
|
1374
|
-
var metadata = (0, util_1$
|
|
1409
|
+
var metadata = (0, util_1$5.shallowClone)(opts.metadata);
|
|
1375
1410
|
var category = opts.category || 'custom';
|
|
1376
1411
|
var timestamp = new Date().toISOString();
|
|
1377
1412
|
this.__store.addBreadcrumb({
|
|
@@ -1386,7 +1421,7 @@ var Client = /** @class */ (function () {
|
|
|
1386
1421
|
* @deprecated Use {@link event} instead.
|
|
1387
1422
|
*/
|
|
1388
1423
|
Client.prototype.logEvent = function (data) {
|
|
1389
|
-
(0, util_1$
|
|
1424
|
+
(0, util_1$5.logDeprecatedMethod)(this.logger, 'Honeybadger.logEvent', 'Honeybadger.event');
|
|
1390
1425
|
this.event('log', data);
|
|
1391
1426
|
};
|
|
1392
1427
|
Client.prototype.event = function (type, data) {
|
|
@@ -1397,6 +1432,13 @@ var Client = /** @class */ (function () {
|
|
|
1397
1432
|
}
|
|
1398
1433
|
this.__eventsLogger.log(__assign$1({ event_type: type, ts: new Date().toISOString() }, data));
|
|
1399
1434
|
};
|
|
1435
|
+
/**
|
|
1436
|
+
* This method currently flushes the event (Insights) queue.
|
|
1437
|
+
* In the future, it should also flush the error queue (assuming an error throttler is implemented).
|
|
1438
|
+
*/
|
|
1439
|
+
Client.prototype.flushAsync = function () {
|
|
1440
|
+
return this.__eventsLogger.flushAsync();
|
|
1441
|
+
};
|
|
1400
1442
|
Client.prototype.__getBreadcrumbs = function () {
|
|
1401
1443
|
return this.__store.getContents('breadcrumbs').slice();
|
|
1402
1444
|
};
|
|
@@ -1410,8 +1452,8 @@ var Client = /** @class */ (function () {
|
|
|
1410
1452
|
return (this.config.environment && this.config.developmentEnvironments.includes(this.config.environment));
|
|
1411
1453
|
};
|
|
1412
1454
|
Client.prototype.__buildPayload = function (notice) {
|
|
1413
|
-
var headers = (0, util_1$
|
|
1414
|
-
var cgiData = (0, util_1$
|
|
1455
|
+
var headers = (0, util_1$5.filter)(notice.headers, this.config.filters) || {};
|
|
1456
|
+
var cgiData = (0, util_1$5.filter)(__assign$1(__assign$1({}, notice.cgiData), (0, util_1$5.formatCGIData)(headers, 'HTTP_')), this.config.filters);
|
|
1415
1457
|
return {
|
|
1416
1458
|
notifier: this.__notifier,
|
|
1417
1459
|
breadcrumbs: {
|
|
@@ -1424,16 +1466,16 @@ var Client = /** @class */ (function () {
|
|
|
1424
1466
|
backtrace: notice.backtrace,
|
|
1425
1467
|
fingerprint: notice.fingerprint,
|
|
1426
1468
|
tags: notice.tags,
|
|
1427
|
-
causes: (0, util_1$
|
|
1469
|
+
causes: (0, util_1$5.getCauses)(notice, this.logger),
|
|
1428
1470
|
},
|
|
1429
1471
|
request: {
|
|
1430
|
-
url: (0, util_1$
|
|
1472
|
+
url: (0, util_1$5.filterUrl)(notice.url, this.config.filters),
|
|
1431
1473
|
component: notice.component,
|
|
1432
1474
|
action: notice.action,
|
|
1433
1475
|
context: notice.context,
|
|
1434
1476
|
cgi_data: cgiData,
|
|
1435
|
-
params: (0, util_1$
|
|
1436
|
-
session: (0, util_1$
|
|
1477
|
+
params: (0, util_1$5.filter)(notice.params, this.config.filters) || {},
|
|
1478
|
+
session: (0, util_1$5.filter)(notice.session, this.config.filters) || {}
|
|
1437
1479
|
},
|
|
1438
1480
|
server: {
|
|
1439
1481
|
project_root: notice.projectRoot,
|
|
@@ -1470,7 +1512,7 @@ var Client = /** @class */ (function () {
|
|
|
1470
1512
|
this.logger.warn('could not send error report: no API key has been configured', notice);
|
|
1471
1513
|
preConditionError = new Error('missing API key');
|
|
1472
1514
|
}
|
|
1473
|
-
var beforeNotifyResult = (0, util_1$
|
|
1515
|
+
var beforeNotifyResult = (0, util_1$5.runBeforeNotifyHandlers)(notice, this.__beforeNotifyHandlers);
|
|
1474
1516
|
if (!preConditionError && !beforeNotifyResult.result) {
|
|
1475
1517
|
this.logger.debug('skipping error report: one or more beforeNotify handlers returned false', notice);
|
|
1476
1518
|
preConditionError = new Error('beforeNotify handlers returned false');
|
|
@@ -1505,10 +1547,10 @@ var Client = /** @class */ (function () {
|
|
|
1505
1547
|
else {
|
|
1506
1548
|
notice.__breadcrumbs = [];
|
|
1507
1549
|
}
|
|
1508
|
-
return (0, util_1$
|
|
1509
|
-
.then(function (sourcePerTrace) { return __awaiter$
|
|
1550
|
+
return (0, util_1$5.getSourceForBacktrace)(originalBacktrace, this.__getSourceFileHandler)
|
|
1551
|
+
.then(function (sourcePerTrace) { return __awaiter$3(_this, void 0, void 0, function () {
|
|
1510
1552
|
var payload;
|
|
1511
|
-
return __generator$
|
|
1553
|
+
return __generator$3(this, function (_a) {
|
|
1512
1554
|
sourcePerTrace.forEach(function (source, index) {
|
|
1513
1555
|
notice.backtrace[index].source = source;
|
|
1514
1556
|
});
|
|
@@ -1521,7 +1563,7 @@ var Client = /** @class */ (function () {
|
|
|
1521
1563
|
'Accept': 'text/json, application/json'
|
|
1522
1564
|
},
|
|
1523
1565
|
method: 'POST',
|
|
1524
|
-
endpoint: (0, util_1$
|
|
1566
|
+
endpoint: (0, util_1$5.endpoint)(this.config.endpoint, '/v1/notices/js'),
|
|
1525
1567
|
maxObjectDepth: this.config.maxObjectDepth,
|
|
1526
1568
|
logger: this.logger,
|
|
1527
1569
|
}, payload)];
|
|
@@ -1529,12 +1571,12 @@ var Client = /** @class */ (function () {
|
|
|
1529
1571
|
}); })
|
|
1530
1572
|
.then(function (res) {
|
|
1531
1573
|
if (res.statusCode !== 201) {
|
|
1532
|
-
(0, util_1$
|
|
1574
|
+
(0, util_1$5.runAfterNotifyHandlers)(notice, _this.__afterNotifyHandlers, new Error("Bad HTTP response: ".concat(res.statusCode)));
|
|
1533
1575
|
_this.logger.warn("Error report failed: unknown response from server. code=".concat(res.statusCode));
|
|
1534
1576
|
return false;
|
|
1535
1577
|
}
|
|
1536
1578
|
var uuid = JSON.parse(res.body).id;
|
|
1537
|
-
(0, util_1$
|
|
1579
|
+
(0, util_1$5.runAfterNotifyHandlers)((0, util_1$5.merge)(notice, {
|
|
1538
1580
|
id: uuid
|
|
1539
1581
|
}), _this.__afterNotifyHandlers);
|
|
1540
1582
|
_this.logger.info("Error report sent \u26A1 https://app.honeybadger.io/notice/".concat(uuid));
|
|
@@ -1542,7 +1584,7 @@ var Client = /** @class */ (function () {
|
|
|
1542
1584
|
})
|
|
1543
1585
|
.catch(function (err) {
|
|
1544
1586
|
_this.logger.error('Error report failed: an unknown error occurred.', "message=".concat(err.message));
|
|
1545
|
-
(0, util_1$
|
|
1587
|
+
(0, util_1$5.runAfterNotifyHandlers)(notice, _this.__afterNotifyHandlers, err);
|
|
1546
1588
|
return false;
|
|
1547
1589
|
});
|
|
1548
1590
|
};
|
|
@@ -1600,7 +1642,7 @@ Object.defineProperty(types, "__esModule", { value: true });
|
|
|
1600
1642
|
|
|
1601
1643
|
var util = {};
|
|
1602
1644
|
|
|
1603
|
-
var __awaiter$
|
|
1645
|
+
var __awaiter$2 = (commonjsGlobal && commonjsGlobal.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
1604
1646
|
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
1605
1647
|
return new (P || (P = Promise))(function (resolve, reject) {
|
|
1606
1648
|
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
@@ -1609,7 +1651,7 @@ var __awaiter$1 = (commonjsGlobal && commonjsGlobal.__awaiter) || function (this
|
|
|
1609
1651
|
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
1610
1652
|
});
|
|
1611
1653
|
};
|
|
1612
|
-
var __generator$
|
|
1654
|
+
var __generator$2 = (commonjsGlobal && commonjsGlobal.__generator) || function (thisArg, body) {
|
|
1613
1655
|
var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
|
|
1614
1656
|
return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
|
|
1615
1657
|
function verb(n) { return function (v) { return step([n, v]); }; }
|
|
@@ -1636,26 +1678,31 @@ var __generator$1 = (commonjsGlobal && commonjsGlobal.__generator) || function (
|
|
|
1636
1678
|
if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
|
|
1637
1679
|
}
|
|
1638
1680
|
};
|
|
1639
|
-
var __importDefault$
|
|
1681
|
+
var __importDefault$4 = (commonjsGlobal && commonjsGlobal.__importDefault) || function (mod) {
|
|
1640
1682
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
1641
1683
|
};
|
|
1642
1684
|
Object.defineProperty(util, "__esModule", { value: true });
|
|
1643
|
-
util.readConfigFromFileSystem = util.getSourceFile = util.getStats = util.fatallyLogAndExit = void 0;
|
|
1644
|
-
var os_1 = __importDefault$
|
|
1645
|
-
var fs_1 = __importDefault$
|
|
1646
|
-
var path_1 = __importDefault$
|
|
1647
|
-
var util_1$
|
|
1648
|
-
var readFile = (0, util_1$
|
|
1649
|
-
function
|
|
1650
|
-
console.
|
|
1685
|
+
util.readConfigFromFileSystem = util.getSourceFile = util.getStats = util.fatallyLogAndExit = util.fatallyLogAndExitGracefully = void 0;
|
|
1686
|
+
var os_1 = __importDefault$4(require$$0__default["default"]);
|
|
1687
|
+
var fs_1 = __importDefault$4(require$$1__default["default"]);
|
|
1688
|
+
var path_1 = __importDefault$4(require$$2__default["default"]);
|
|
1689
|
+
var util_1$4 = require$$3__default["default"];
|
|
1690
|
+
var readFile = (0, util_1$4.promisify)(fs_1.default.readFile);
|
|
1691
|
+
function fatallyLogAndExitGracefully(signal) {
|
|
1692
|
+
console.log("[Honeybadger] Received ".concat(signal, ", exiting immediately"));
|
|
1693
|
+
process.exit();
|
|
1694
|
+
}
|
|
1695
|
+
util.fatallyLogAndExitGracefully = fatallyLogAndExitGracefully;
|
|
1696
|
+
function fatallyLogAndExit(err, source) {
|
|
1697
|
+
console.error("[Honeybadger] Exiting process due to ".concat(source));
|
|
1651
1698
|
console.error(err.stack || err);
|
|
1652
1699
|
process.exit(1);
|
|
1653
1700
|
}
|
|
1654
1701
|
util.fatallyLogAndExit = fatallyLogAndExit;
|
|
1655
1702
|
function getStats() {
|
|
1656
|
-
return __awaiter$
|
|
1703
|
+
return __awaiter$2(this, void 0, void 0, function () {
|
|
1657
1704
|
var load, stats, fallback, memData, data, results;
|
|
1658
|
-
return __generator$
|
|
1705
|
+
return __generator$2(this, function (_a) {
|
|
1659
1706
|
switch (_a.label) {
|
|
1660
1707
|
case 0:
|
|
1661
1708
|
load = os_1.default.loadavg();
|
|
@@ -1714,8 +1761,8 @@ util.getStats = getStats;
|
|
|
1714
1761
|
* @param path to source code
|
|
1715
1762
|
*/
|
|
1716
1763
|
function getSourceFile(path) {
|
|
1717
|
-
return __awaiter$
|
|
1718
|
-
return __generator$
|
|
1764
|
+
return __awaiter$2(this, void 0, void 0, function () {
|
|
1765
|
+
return __generator$2(this, function (_a) {
|
|
1719
1766
|
switch (_a.label) {
|
|
1720
1767
|
case 0:
|
|
1721
1768
|
_a.trys.push([0, 2, , 3]);
|
|
@@ -1852,7 +1899,7 @@ aws_lambda.removeAwsDefaultUncaughtExceptionListener = removeAwsDefaultUncaughtE
|
|
|
1852
1899
|
|
|
1853
1900
|
Object.defineProperty(uncaught_exception_monitor, "__esModule", { value: true });
|
|
1854
1901
|
var aws_lambda_1 = aws_lambda;
|
|
1855
|
-
var util_1$
|
|
1902
|
+
var util_1$3 = util;
|
|
1856
1903
|
var UncaughtExceptionMonitor = /** @class */ (function () {
|
|
1857
1904
|
function UncaughtExceptionMonitor() {
|
|
1858
1905
|
this.__isReporting = false;
|
|
@@ -1865,6 +1912,7 @@ var UncaughtExceptionMonitor = /** @class */ (function () {
|
|
|
1865
1912
|
};
|
|
1866
1913
|
UncaughtExceptionMonitor.prototype.makeListener = function () {
|
|
1867
1914
|
var _this = this;
|
|
1915
|
+
// noinspection UnnecessaryLocalVariableJS
|
|
1868
1916
|
var honeybadgerUncaughtExceptionListener = function (uncaughtError) {
|
|
1869
1917
|
if (_this.__isReporting || !_this.__client) {
|
|
1870
1918
|
return;
|
|
@@ -1872,7 +1920,7 @@ var UncaughtExceptionMonitor = /** @class */ (function () {
|
|
|
1872
1920
|
// report only the first error - prevent reporting recursive errors
|
|
1873
1921
|
if (_this.__handlerAlreadyCalled) {
|
|
1874
1922
|
if (!_this.hasOtherUncaughtExceptionListeners()) {
|
|
1875
|
-
(0, util_1$
|
|
1923
|
+
(0, util_1$3.fatallyLogAndExit)(uncaughtError, 'uncaught exception');
|
|
1876
1924
|
}
|
|
1877
1925
|
return;
|
|
1878
1926
|
}
|
|
@@ -1883,7 +1931,7 @@ var UncaughtExceptionMonitor = /** @class */ (function () {
|
|
|
1883
1931
|
_this.__handlerAlreadyCalled = true;
|
|
1884
1932
|
_this.__client.config.afterUncaught(uncaughtError);
|
|
1885
1933
|
if (!_this.hasOtherUncaughtExceptionListeners()) {
|
|
1886
|
-
(0, util_1$
|
|
1934
|
+
(0, util_1$3.fatallyLogAndExit)(uncaughtError, 'uncaught exception');
|
|
1887
1935
|
}
|
|
1888
1936
|
}
|
|
1889
1937
|
});
|
|
@@ -1929,13 +1977,13 @@ var UncaughtExceptionMonitor = /** @class */ (function () {
|
|
|
1929
1977
|
}());
|
|
1930
1978
|
uncaught_exception_monitor.default = UncaughtExceptionMonitor;
|
|
1931
1979
|
|
|
1932
|
-
var __importDefault$
|
|
1980
|
+
var __importDefault$3 = (commonjsGlobal && commonjsGlobal.__importDefault) || function (mod) {
|
|
1933
1981
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
1934
1982
|
};
|
|
1935
1983
|
Object.defineProperty(uncaught_exception_plugin, "__esModule", { value: true });
|
|
1936
|
-
var uncaught_exception_monitor_1 = __importDefault$
|
|
1984
|
+
var uncaught_exception_monitor_1 = __importDefault$3(uncaught_exception_monitor);
|
|
1937
1985
|
var uncaughtExceptionMonitor = new uncaught_exception_monitor_1.default();
|
|
1938
|
-
function default_1$
|
|
1986
|
+
function default_1$2() {
|
|
1939
1987
|
return {
|
|
1940
1988
|
load: function (client) {
|
|
1941
1989
|
uncaughtExceptionMonitor.setClient(client);
|
|
@@ -1949,14 +1997,14 @@ function default_1$1() {
|
|
|
1949
1997
|
shouldReloadOnConfigure: true,
|
|
1950
1998
|
};
|
|
1951
1999
|
}
|
|
1952
|
-
uncaught_exception_plugin.default = default_1$
|
|
2000
|
+
uncaught_exception_plugin.default = default_1$2;
|
|
1953
2001
|
|
|
1954
2002
|
var unhandled_rejection_plugin = {};
|
|
1955
2003
|
|
|
1956
2004
|
var unhandled_rejection_monitor = {};
|
|
1957
2005
|
|
|
1958
2006
|
Object.defineProperty(unhandled_rejection_monitor, "__esModule", { value: true });
|
|
1959
|
-
var util_1$
|
|
2007
|
+
var util_1$2 = util;
|
|
1960
2008
|
var UnhandledRejectionMonitor = /** @class */ (function () {
|
|
1961
2009
|
function UnhandledRejectionMonitor() {
|
|
1962
2010
|
this.__isReporting = false;
|
|
@@ -1967,13 +2015,14 @@ var UnhandledRejectionMonitor = /** @class */ (function () {
|
|
|
1967
2015
|
};
|
|
1968
2016
|
UnhandledRejectionMonitor.prototype.makeListener = function () {
|
|
1969
2017
|
var _this = this;
|
|
2018
|
+
// noinspection UnnecessaryLocalVariableJS
|
|
1970
2019
|
var honeybadgerUnhandledRejectionListener = function (reason, _promise) {
|
|
1971
2020
|
_this.__isReporting = true;
|
|
1972
2021
|
_this.__client.notify(reason, { component: 'unhandledRejection' }, {
|
|
1973
2022
|
afterNotify: function () {
|
|
1974
2023
|
_this.__isReporting = false;
|
|
1975
2024
|
if (!_this.hasOtherUnhandledRejectionListeners()) {
|
|
1976
|
-
(0, util_1$
|
|
2025
|
+
(0, util_1$2.fatallyLogAndExit)(reason, 'unhandled rejection');
|
|
1977
2026
|
}
|
|
1978
2027
|
}
|
|
1979
2028
|
});
|
|
@@ -2008,13 +2057,13 @@ var UnhandledRejectionMonitor = /** @class */ (function () {
|
|
|
2008
2057
|
}());
|
|
2009
2058
|
unhandled_rejection_monitor.default = UnhandledRejectionMonitor;
|
|
2010
2059
|
|
|
2011
|
-
var __importDefault$
|
|
2060
|
+
var __importDefault$2 = (commonjsGlobal && commonjsGlobal.__importDefault) || function (mod) {
|
|
2012
2061
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
2013
2062
|
};
|
|
2014
2063
|
Object.defineProperty(unhandled_rejection_plugin, "__esModule", { value: true });
|
|
2015
|
-
var unhandled_rejection_monitor_1 = __importDefault$
|
|
2064
|
+
var unhandled_rejection_monitor_1 = __importDefault$2(unhandled_rejection_monitor);
|
|
2016
2065
|
var unhandledRejectionMonitor = new unhandled_rejection_monitor_1.default();
|
|
2017
|
-
function default_1() {
|
|
2066
|
+
function default_1$1() {
|
|
2018
2067
|
return {
|
|
2019
2068
|
load: function (client) {
|
|
2020
2069
|
unhandledRejectionMonitor.setClient(client);
|
|
@@ -2028,7 +2077,137 @@ function default_1() {
|
|
|
2028
2077
|
shouldReloadOnConfigure: true,
|
|
2029
2078
|
};
|
|
2030
2079
|
}
|
|
2031
|
-
unhandled_rejection_plugin.default = default_1;
|
|
2080
|
+
unhandled_rejection_plugin.default = default_1$1;
|
|
2081
|
+
|
|
2082
|
+
var shutdown_plugin = {};
|
|
2083
|
+
|
|
2084
|
+
var shutdown_monitor = {};
|
|
2085
|
+
|
|
2086
|
+
var __awaiter$1 = (commonjsGlobal && commonjsGlobal.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
2087
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
2088
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
2089
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
2090
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
2091
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
2092
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
2093
|
+
});
|
|
2094
|
+
};
|
|
2095
|
+
var __generator$1 = (commonjsGlobal && commonjsGlobal.__generator) || function (thisArg, body) {
|
|
2096
|
+
var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
|
|
2097
|
+
return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
|
|
2098
|
+
function verb(n) { return function (v) { return step([n, v]); }; }
|
|
2099
|
+
function step(op) {
|
|
2100
|
+
if (f) throw new TypeError("Generator is already executing.");
|
|
2101
|
+
while (_) try {
|
|
2102
|
+
if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
|
|
2103
|
+
if (y = 0, t) op = [op[0] & 2, t.value];
|
|
2104
|
+
switch (op[0]) {
|
|
2105
|
+
case 0: case 1: t = op; break;
|
|
2106
|
+
case 4: _.label++; return { value: op[1], done: false };
|
|
2107
|
+
case 5: _.label++; y = op[1]; op = [0]; continue;
|
|
2108
|
+
case 7: op = _.ops.pop(); _.trys.pop(); continue;
|
|
2109
|
+
default:
|
|
2110
|
+
if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
|
|
2111
|
+
if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
|
|
2112
|
+
if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
|
|
2113
|
+
if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
|
|
2114
|
+
if (t[2]) _.ops.pop();
|
|
2115
|
+
_.trys.pop(); continue;
|
|
2116
|
+
}
|
|
2117
|
+
op = body.call(thisArg, _);
|
|
2118
|
+
} catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
|
|
2119
|
+
if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
|
|
2120
|
+
}
|
|
2121
|
+
};
|
|
2122
|
+
Object.defineProperty(shutdown_monitor, "__esModule", { value: true });
|
|
2123
|
+
var util_1$1 = util;
|
|
2124
|
+
var ShutdownMonitor = /** @class */ (function () {
|
|
2125
|
+
function ShutdownMonitor() {
|
|
2126
|
+
this.__isReporting = false;
|
|
2127
|
+
this.__listener = this.makeListener();
|
|
2128
|
+
}
|
|
2129
|
+
ShutdownMonitor.prototype.setClient = function (client) {
|
|
2130
|
+
this.__client = client;
|
|
2131
|
+
};
|
|
2132
|
+
ShutdownMonitor.prototype.makeListener = function () {
|
|
2133
|
+
var _this = this;
|
|
2134
|
+
// noinspection UnnecessaryLocalVariableJS
|
|
2135
|
+
var honeybadgerShutdownListener = function (signal) { return __awaiter$1(_this, void 0, void 0, function () {
|
|
2136
|
+
return __generator$1(this, function (_a) {
|
|
2137
|
+
switch (_a.label) {
|
|
2138
|
+
case 0:
|
|
2139
|
+
if (this.__isReporting || !this.__client) {
|
|
2140
|
+
return [2 /*return*/];
|
|
2141
|
+
}
|
|
2142
|
+
this.__isReporting = true;
|
|
2143
|
+
return [4 /*yield*/, this.__client.flushAsync()];
|
|
2144
|
+
case 1:
|
|
2145
|
+
_a.sent();
|
|
2146
|
+
this.__isReporting = false;
|
|
2147
|
+
if (!this.hasOtherShutdownListeners(signal)) {
|
|
2148
|
+
(0, util_1$1.fatallyLogAndExitGracefully)(signal);
|
|
2149
|
+
}
|
|
2150
|
+
return [2 /*return*/];
|
|
2151
|
+
}
|
|
2152
|
+
});
|
|
2153
|
+
}); };
|
|
2154
|
+
return honeybadgerShutdownListener;
|
|
2155
|
+
};
|
|
2156
|
+
ShutdownMonitor.prototype.maybeAddListener = function () {
|
|
2157
|
+
for (var _i = 0, _a = ShutdownMonitor.KILL_SIGNALS; _i < _a.length; _i++) {
|
|
2158
|
+
var signal = _a[_i];
|
|
2159
|
+
var signalListeners = process.listeners(signal);
|
|
2160
|
+
if (!signalListeners.includes(this.__listener)) {
|
|
2161
|
+
process.on(signal, this.__listener);
|
|
2162
|
+
}
|
|
2163
|
+
}
|
|
2164
|
+
};
|
|
2165
|
+
ShutdownMonitor.prototype.maybeRemoveListener = function () {
|
|
2166
|
+
for (var _i = 0, _a = ShutdownMonitor.KILL_SIGNALS; _i < _a.length; _i++) {
|
|
2167
|
+
var signal = _a[_i];
|
|
2168
|
+
var signalListeners = process.listeners(signal);
|
|
2169
|
+
if (signalListeners.includes(this.__listener)) {
|
|
2170
|
+
process.removeListener(signal, this.__listener);
|
|
2171
|
+
}
|
|
2172
|
+
}
|
|
2173
|
+
};
|
|
2174
|
+
ShutdownMonitor.prototype.hasOtherShutdownListeners = function (signal) {
|
|
2175
|
+
var _this = this;
|
|
2176
|
+
var otherListeners = process
|
|
2177
|
+
.listeners(signal)
|
|
2178
|
+
.filter(function (listener) { return listener !== _this.__listener; });
|
|
2179
|
+
return otherListeners.length > 0;
|
|
2180
|
+
};
|
|
2181
|
+
// SIGTERM is raised by AWS Lambda when the function is being shut down
|
|
2182
|
+
// SIGINT is raised by the user pressing CTRL+C
|
|
2183
|
+
ShutdownMonitor.KILL_SIGNALS = ['SIGTERM', 'SIGINT'];
|
|
2184
|
+
return ShutdownMonitor;
|
|
2185
|
+
}());
|
|
2186
|
+
shutdown_monitor.default = ShutdownMonitor;
|
|
2187
|
+
|
|
2188
|
+
var __importDefault$1 = (commonjsGlobal && commonjsGlobal.__importDefault) || function (mod) {
|
|
2189
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
2190
|
+
};
|
|
2191
|
+
Object.defineProperty(shutdown_plugin, "__esModule", { value: true });
|
|
2192
|
+
var shutdown_monitor_1 = __importDefault$1(shutdown_monitor);
|
|
2193
|
+
var shutdownMonitor = new shutdown_monitor_1.default();
|
|
2194
|
+
function default_1() {
|
|
2195
|
+
return {
|
|
2196
|
+
load: function (client) {
|
|
2197
|
+
shutdownMonitor.setClient(client);
|
|
2198
|
+
// at the moment, the shutdown monitor only sends events from the queue
|
|
2199
|
+
// if we implement a queue for throttling errors, we won't have to check for `config.eventsEnabled`
|
|
2200
|
+
if (client.config.eventsEnabled) {
|
|
2201
|
+
shutdownMonitor.maybeAddListener();
|
|
2202
|
+
}
|
|
2203
|
+
else {
|
|
2204
|
+
shutdownMonitor.maybeRemoveListener();
|
|
2205
|
+
}
|
|
2206
|
+
},
|
|
2207
|
+
shouldReloadOnConfigure: true,
|
|
2208
|
+
};
|
|
2209
|
+
}
|
|
2210
|
+
shutdown_plugin.default = default_1;
|
|
2032
2211
|
|
|
2033
2212
|
var middleware = {};
|
|
2034
2213
|
|
|
@@ -2700,6 +2879,7 @@ client.CheckInsClient = CheckInsClient;
|
|
|
2700
2879
|
var util_1 = util;
|
|
2701
2880
|
var uncaught_exception_plugin_1 = __importDefault(uncaught_exception_plugin);
|
|
2702
2881
|
var unhandled_rejection_plugin_1 = __importDefault(unhandled_rejection_plugin);
|
|
2882
|
+
var shutdown_plugin_1 = __importDefault(shutdown_plugin);
|
|
2703
2883
|
var middleware_1 = middleware;
|
|
2704
2884
|
var aws_lambda_1 = aws_lambda;
|
|
2705
2885
|
var transport_1 = transport;
|
|
@@ -2709,6 +2889,7 @@ client.CheckInsClient = CheckInsClient;
|
|
|
2709
2889
|
var DEFAULT_PLUGINS = [
|
|
2710
2890
|
(0, uncaught_exception_plugin_1.default)(),
|
|
2711
2891
|
(0, unhandled_rejection_plugin_1.default)(),
|
|
2892
|
+
(0, shutdown_plugin_1.default)(),
|
|
2712
2893
|
core_1.Plugins.events(),
|
|
2713
2894
|
];
|
|
2714
2895
|
var Honeybadger = /** @class */ (function (_super) {
|
|
@@ -2861,7 +3042,7 @@ client.CheckInsClient = CheckInsClient;
|
|
|
2861
3042
|
var NOTIFIER = {
|
|
2862
3043
|
name: '@honeybadger-io/js',
|
|
2863
3044
|
url: 'https://github.com/honeybadger-io/honeybadger-js/tree/master/packages/js',
|
|
2864
|
-
version: '6.
|
|
3045
|
+
version: '6.11.1'
|
|
2865
3046
|
};
|
|
2866
3047
|
var userAgent = function () {
|
|
2867
3048
|
return "Honeybadger JS Server Client ".concat(NOTIFIER.version, ", ").concat(os_1.default.version(), "; ").concat(os_1.default.platform());
|