rollbar 2.24.0 → 2.25.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/.github/pull_request_template.md +15 -6
- package/.github/workflows/ci.yml +1 -1
- package/dist/rollbar.js +54 -14
- package/dist/rollbar.js.map +1 -1
- package/dist/rollbar.min.js +1 -1
- package/dist/rollbar.min.js.map +1 -1
- package/dist/rollbar.named-amd.js +54 -14
- package/dist/rollbar.named-amd.js.map +1 -1
- package/dist/rollbar.named-amd.min.js +1 -1
- package/dist/rollbar.named-amd.min.js.map +1 -1
- package/dist/rollbar.noconflict.umd.js +54 -14
- package/dist/rollbar.noconflict.umd.js.map +1 -1
- package/dist/rollbar.noconflict.umd.min.js +1 -1
- package/dist/rollbar.noconflict.umd.min.js.map +1 -1
- package/dist/rollbar.snippet.js +1 -1
- package/dist/rollbar.umd.js +54 -14
- package/dist/rollbar.umd.js.map +1 -1
- package/dist/rollbar.umd.min.js +1 -1
- package/dist/rollbar.umd.min.js.map +1 -1
- package/index.d.ts +83 -3
- package/package.json +4 -6
- package/src/api.js +6 -1
- package/src/browser/shim.js +8 -1
- package/src/browser/telemetry.js +6 -4
- package/src/browser/transforms.js +2 -2
- package/src/defaults.js +1 -1
- package/src/errorParser.js +2 -2
- package/src/server/parser.js +12 -14
- package/src/server/transforms.js +1 -1
- package/src/utility.js +37 -4
- package/test/browser.core.test.js +216 -126
- package/test/browser.rollbar.test.js +330 -244
- package/test/browser.transforms.test.js +43 -0
- package/test/react-native.rollbar.test.js +12 -8
- package/test/server.rollbar.test.js +6 -6
- package/test/server.transforms.test.js +52 -1
|
@@ -491,6 +491,37 @@ function wrapCallback(logger, f) {
|
|
|
491
491
|
};
|
|
492
492
|
}
|
|
493
493
|
|
|
494
|
+
function nonCircularClone(obj) {
|
|
495
|
+
var seen = [obj];
|
|
496
|
+
|
|
497
|
+
function clone(obj, seen) {
|
|
498
|
+
var value, name, newSeen, result = {};
|
|
499
|
+
|
|
500
|
+
try {
|
|
501
|
+
for (name in obj) {
|
|
502
|
+
value = obj[name];
|
|
503
|
+
|
|
504
|
+
if (value && (isType(value, 'object') || isType(value, 'array'))) {
|
|
505
|
+
if (seen.includes(value)) {
|
|
506
|
+
result[name] = 'Removed circular reference: ' + typeName(value);
|
|
507
|
+
} else {
|
|
508
|
+
newSeen = seen.slice();
|
|
509
|
+
newSeen.push(value);
|
|
510
|
+
result[name] = clone(value, newSeen);
|
|
511
|
+
}
|
|
512
|
+
continue;
|
|
513
|
+
}
|
|
514
|
+
|
|
515
|
+
result[name] = value;
|
|
516
|
+
}
|
|
517
|
+
} catch (e) {
|
|
518
|
+
result = 'Failed cloning custom data: ' + e.message;
|
|
519
|
+
}
|
|
520
|
+
return result;
|
|
521
|
+
}
|
|
522
|
+
return clone(obj, seen);
|
|
523
|
+
}
|
|
524
|
+
|
|
494
525
|
function createItem(args, logger, notifier, requestKeys, lambdaContext) {
|
|
495
526
|
var message, err, custom, callback, request;
|
|
496
527
|
var arg;
|
|
@@ -548,10 +579,12 @@ function createItem(args, logger, notifier, requestKeys, lambdaContext) {
|
|
|
548
579
|
}
|
|
549
580
|
}
|
|
550
581
|
|
|
582
|
+
// if custom is an array this turns it into an object with integer keys
|
|
583
|
+
if (custom) custom = nonCircularClone(custom);
|
|
584
|
+
|
|
551
585
|
if (extraArgs.length > 0) {
|
|
552
|
-
|
|
553
|
-
custom =
|
|
554
|
-
custom.extraArgs = extraArgs;
|
|
586
|
+
if (!custom) custom = nonCircularClone({});
|
|
587
|
+
custom.extraArgs = nonCircularClone(extraArgs);
|
|
555
588
|
}
|
|
556
589
|
|
|
557
590
|
var item = {
|
|
@@ -596,7 +629,7 @@ function addErrorContext(item, errors) {
|
|
|
596
629
|
try {
|
|
597
630
|
for (var i = 0; i < errors.length; ++i) {
|
|
598
631
|
if (errors[i].hasOwnProperty('rollbarContext')) {
|
|
599
|
-
custom = merge(custom, errors[i].rollbarContext);
|
|
632
|
+
custom = merge(custom, nonCircularClone(errors[i].rollbarContext));
|
|
600
633
|
contextAdded = true;
|
|
601
634
|
}
|
|
602
635
|
}
|
|
@@ -1051,11 +1084,11 @@ function Stack(exception, skip) {
|
|
|
1051
1084
|
function parse(e, skip) {
|
|
1052
1085
|
var err = e;
|
|
1053
1086
|
|
|
1054
|
-
if (err.nested) {
|
|
1087
|
+
if (err.nested || err.cause) {
|
|
1055
1088
|
var traceChain = [];
|
|
1056
1089
|
while (err) {
|
|
1057
1090
|
traceChain.push(new Stack(err, skip));
|
|
1058
|
-
err = err.nested;
|
|
1091
|
+
err = err.nested || err.cause;
|
|
1059
1092
|
|
|
1060
1093
|
skip = 0; // Only apply skip value to primary error
|
|
1061
1094
|
}
|
|
@@ -2871,7 +2904,12 @@ function Api(options, transport, urllib, truncation, jsonBackup) {
|
|
|
2871
2904
|
Api.prototype.postItem = function(data, callback) {
|
|
2872
2905
|
var transportOptions = helpers.transportOptions(this.transportOptions, 'POST');
|
|
2873
2906
|
var payload = helpers.buildPayload(this.accessToken, data, this.jsonBackup);
|
|
2874
|
-
|
|
2907
|
+
var self = this;
|
|
2908
|
+
|
|
2909
|
+
// ensure the network request is scheduled after the current tick.
|
|
2910
|
+
setTimeout(function() {
|
|
2911
|
+
self.transport.post(self.accessToken, transportOptions, payload, callback);
|
|
2912
|
+
}, 0);
|
|
2875
2913
|
};
|
|
2876
2914
|
|
|
2877
2915
|
/**
|
|
@@ -3519,8 +3557,8 @@ function addErrorContext(item) {
|
|
|
3519
3557
|
|
|
3520
3558
|
chain.push(err);
|
|
3521
3559
|
|
|
3522
|
-
while (err.nested) {
|
|
3523
|
-
err = err.nested;
|
|
3560
|
+
while (err.nested || err.cause) {
|
|
3561
|
+
err = err.nested || err.cause;
|
|
3524
3562
|
chain.push(err);
|
|
3525
3563
|
}
|
|
3526
3564
|
|
|
@@ -4553,7 +4591,7 @@ module.exports = {
|
|
|
4553
4591
|
|
|
4554
4592
|
|
|
4555
4593
|
module.exports = {
|
|
4556
|
-
version: '2.
|
|
4594
|
+
version: '2.25.1',
|
|
4557
4595
|
endpoint: 'api.rollbar.com/api/1/item/',
|
|
4558
4596
|
logLevel: 'debug',
|
|
4559
4597
|
reportLevel: 'debug',
|
|
@@ -5229,8 +5267,10 @@ Instrumenter.prototype.instrumentNetwork = function() {
|
|
|
5229
5267
|
// Test to ensure body is a Promise, which it should always be.
|
|
5230
5268
|
if (typeof body.then === 'function') {
|
|
5231
5269
|
body.then(function (text) {
|
|
5232
|
-
if (self.isJsonContentType(metadata.response_content_type)) {
|
|
5270
|
+
if (text && self.isJsonContentType(metadata.response_content_type)) {
|
|
5233
5271
|
metadata.response.body = self.scrubJson(text);
|
|
5272
|
+
} else {
|
|
5273
|
+
metadata.response.body = text;
|
|
5234
5274
|
}
|
|
5235
5275
|
});
|
|
5236
5276
|
} else {
|
|
@@ -5555,16 +5595,16 @@ Instrumenter.prototype.handleCspError = function(message) {
|
|
|
5555
5595
|
}
|
|
5556
5596
|
|
|
5557
5597
|
Instrumenter.prototype.deinstrumentContentSecurityPolicy = function() {
|
|
5558
|
-
if (!('addEventListener' in this.
|
|
5598
|
+
if (!('addEventListener' in this._document)) { return; }
|
|
5559
5599
|
|
|
5560
5600
|
this.removeListeners('contentsecuritypolicy');
|
|
5561
5601
|
};
|
|
5562
5602
|
|
|
5563
5603
|
Instrumenter.prototype.instrumentContentSecurityPolicy = function() {
|
|
5564
|
-
if (!('addEventListener' in this.
|
|
5604
|
+
if (!('addEventListener' in this._document)) { return; }
|
|
5565
5605
|
|
|
5566
5606
|
var cspHandler = this.handleCspEvent.bind(this);
|
|
5567
|
-
this.addListener('contentsecuritypolicy', this.
|
|
5607
|
+
this.addListener('contentsecuritypolicy', this._document, 'securitypolicyviolation', null, cspHandler, false);
|
|
5568
5608
|
};
|
|
5569
5609
|
|
|
5570
5610
|
Instrumenter.prototype.addListener = function(section, obj, type, altType, handler, capture) {
|