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
|
@@ -501,6 +501,37 @@ function wrapCallback(logger, f) {
|
|
|
501
501
|
};
|
|
502
502
|
}
|
|
503
503
|
|
|
504
|
+
function nonCircularClone(obj) {
|
|
505
|
+
var seen = [obj];
|
|
506
|
+
|
|
507
|
+
function clone(obj, seen) {
|
|
508
|
+
var value, name, newSeen, result = {};
|
|
509
|
+
|
|
510
|
+
try {
|
|
511
|
+
for (name in obj) {
|
|
512
|
+
value = obj[name];
|
|
513
|
+
|
|
514
|
+
if (value && (isType(value, 'object') || isType(value, 'array'))) {
|
|
515
|
+
if (seen.includes(value)) {
|
|
516
|
+
result[name] = 'Removed circular reference: ' + typeName(value);
|
|
517
|
+
} else {
|
|
518
|
+
newSeen = seen.slice();
|
|
519
|
+
newSeen.push(value);
|
|
520
|
+
result[name] = clone(value, newSeen);
|
|
521
|
+
}
|
|
522
|
+
continue;
|
|
523
|
+
}
|
|
524
|
+
|
|
525
|
+
result[name] = value;
|
|
526
|
+
}
|
|
527
|
+
} catch (e) {
|
|
528
|
+
result = 'Failed cloning custom data: ' + e.message;
|
|
529
|
+
}
|
|
530
|
+
return result;
|
|
531
|
+
}
|
|
532
|
+
return clone(obj, seen);
|
|
533
|
+
}
|
|
534
|
+
|
|
504
535
|
function createItem(args, logger, notifier, requestKeys, lambdaContext) {
|
|
505
536
|
var message, err, custom, callback, request;
|
|
506
537
|
var arg;
|
|
@@ -558,10 +589,12 @@ function createItem(args, logger, notifier, requestKeys, lambdaContext) {
|
|
|
558
589
|
}
|
|
559
590
|
}
|
|
560
591
|
|
|
592
|
+
// if custom is an array this turns it into an object with integer keys
|
|
593
|
+
if (custom) custom = nonCircularClone(custom);
|
|
594
|
+
|
|
561
595
|
if (extraArgs.length > 0) {
|
|
562
|
-
|
|
563
|
-
custom =
|
|
564
|
-
custom.extraArgs = extraArgs;
|
|
596
|
+
if (!custom) custom = nonCircularClone({});
|
|
597
|
+
custom.extraArgs = nonCircularClone(extraArgs);
|
|
565
598
|
}
|
|
566
599
|
|
|
567
600
|
var item = {
|
|
@@ -606,7 +639,7 @@ function addErrorContext(item, errors) {
|
|
|
606
639
|
try {
|
|
607
640
|
for (var i = 0; i < errors.length; ++i) {
|
|
608
641
|
if (errors[i].hasOwnProperty('rollbarContext')) {
|
|
609
|
-
custom = merge(custom, errors[i].rollbarContext);
|
|
642
|
+
custom = merge(custom, nonCircularClone(errors[i].rollbarContext));
|
|
610
643
|
contextAdded = true;
|
|
611
644
|
}
|
|
612
645
|
}
|
|
@@ -1061,11 +1094,11 @@ function Stack(exception, skip) {
|
|
|
1061
1094
|
function parse(e, skip) {
|
|
1062
1095
|
var err = e;
|
|
1063
1096
|
|
|
1064
|
-
if (err.nested) {
|
|
1097
|
+
if (err.nested || err.cause) {
|
|
1065
1098
|
var traceChain = [];
|
|
1066
1099
|
while (err) {
|
|
1067
1100
|
traceChain.push(new Stack(err, skip));
|
|
1068
|
-
err = err.nested;
|
|
1101
|
+
err = err.nested || err.cause;
|
|
1069
1102
|
|
|
1070
1103
|
skip = 0; // Only apply skip value to primary error
|
|
1071
1104
|
}
|
|
@@ -2866,7 +2899,12 @@ function Api(options, transport, urllib, truncation, jsonBackup) {
|
|
|
2866
2899
|
Api.prototype.postItem = function(data, callback) {
|
|
2867
2900
|
var transportOptions = helpers.transportOptions(this.transportOptions, 'POST');
|
|
2868
2901
|
var payload = helpers.buildPayload(this.accessToken, data, this.jsonBackup);
|
|
2869
|
-
|
|
2902
|
+
var self = this;
|
|
2903
|
+
|
|
2904
|
+
// ensure the network request is scheduled after the current tick.
|
|
2905
|
+
setTimeout(function() {
|
|
2906
|
+
self.transport.post(self.accessToken, transportOptions, payload, callback);
|
|
2907
|
+
}, 0);
|
|
2870
2908
|
};
|
|
2871
2909
|
|
|
2872
2910
|
/**
|
|
@@ -3514,8 +3552,8 @@ function addErrorContext(item) {
|
|
|
3514
3552
|
|
|
3515
3553
|
chain.push(err);
|
|
3516
3554
|
|
|
3517
|
-
while (err.nested) {
|
|
3518
|
-
err = err.nested;
|
|
3555
|
+
while (err.nested || err.cause) {
|
|
3556
|
+
err = err.nested || err.cause;
|
|
3519
3557
|
chain.push(err);
|
|
3520
3558
|
}
|
|
3521
3559
|
|
|
@@ -4548,7 +4586,7 @@ module.exports = {
|
|
|
4548
4586
|
|
|
4549
4587
|
|
|
4550
4588
|
module.exports = {
|
|
4551
|
-
version: '2.
|
|
4589
|
+
version: '2.25.1',
|
|
4552
4590
|
endpoint: 'api.rollbar.com/api/1/item/',
|
|
4553
4591
|
logLevel: 'debug',
|
|
4554
4592
|
reportLevel: 'debug',
|
|
@@ -5224,8 +5262,10 @@ Instrumenter.prototype.instrumentNetwork = function() {
|
|
|
5224
5262
|
// Test to ensure body is a Promise, which it should always be.
|
|
5225
5263
|
if (typeof body.then === 'function') {
|
|
5226
5264
|
body.then(function (text) {
|
|
5227
|
-
if (self.isJsonContentType(metadata.response_content_type)) {
|
|
5265
|
+
if (text && self.isJsonContentType(metadata.response_content_type)) {
|
|
5228
5266
|
metadata.response.body = self.scrubJson(text);
|
|
5267
|
+
} else {
|
|
5268
|
+
metadata.response.body = text;
|
|
5229
5269
|
}
|
|
5230
5270
|
});
|
|
5231
5271
|
} else {
|
|
@@ -5550,16 +5590,16 @@ Instrumenter.prototype.handleCspError = function(message) {
|
|
|
5550
5590
|
}
|
|
5551
5591
|
|
|
5552
5592
|
Instrumenter.prototype.deinstrumentContentSecurityPolicy = function() {
|
|
5553
|
-
if (!('addEventListener' in this.
|
|
5593
|
+
if (!('addEventListener' in this._document)) { return; }
|
|
5554
5594
|
|
|
5555
5595
|
this.removeListeners('contentsecuritypolicy');
|
|
5556
5596
|
};
|
|
5557
5597
|
|
|
5558
5598
|
Instrumenter.prototype.instrumentContentSecurityPolicy = function() {
|
|
5559
|
-
if (!('addEventListener' in this.
|
|
5599
|
+
if (!('addEventListener' in this._document)) { return; }
|
|
5560
5600
|
|
|
5561
5601
|
var cspHandler = this.handleCspEvent.bind(this);
|
|
5562
|
-
this.addListener('contentsecuritypolicy', this.
|
|
5602
|
+
this.addListener('contentsecuritypolicy', this._document, 'securitypolicyviolation', null, cspHandler, false);
|
|
5563
5603
|
};
|
|
5564
5604
|
|
|
5565
5605
|
Instrumenter.prototype.addListener = function(section, obj, type, altType, handler, capture) {
|