Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Merge branch 'master' into update-uuid
  • Loading branch information
ijsnow committed Mar 16, 2022
2 parents 4581d53 + fc88371 commit 1936f98
Show file tree
Hide file tree
Showing 30 changed files with 352 additions and 55 deletions.
43 changes: 38 additions & 5 deletions dist/rollbar.js
Expand Up @@ -491,6 +491,37 @@ function wrapCallback(logger, f) {
};
}

function nonCircularClone(obj) {
var seen = [obj];

function clone(obj, seen) {
var value, name, newSeen, result = {};

try {
for (name in obj) {
value = obj[name];

if (value && (isType(value, 'object') || isType(value, 'array'))) {
if (seen.includes(value)) {
result[name] = 'Removed circular reference: ' + typeName(value);
} else {
newSeen = seen.slice();
newSeen.push(value);
result[name] = clone(value, newSeen);
}
continue;
}

result[name] = value;
}
} catch (e) {
result = 'Failed cloning custom data: ' + e.message;
}
return result;
}
return clone(obj, seen);
}

function createItem(args, logger, notifier, requestKeys, lambdaContext) {
var message, err, custom, callback, request;
var arg;
Expand Down Expand Up @@ -548,10 +579,12 @@ function createItem(args, logger, notifier, requestKeys, lambdaContext) {
}
}

// if custom is an array this turns it into an object with integer keys
if (custom) custom = nonCircularClone(custom);

if (extraArgs.length > 0) {
// if custom is an array this turns it into an object with integer keys
custom = merge(custom);
custom.extraArgs = extraArgs;
if (!custom) custom = nonCircularClone({});
custom.extraArgs = nonCircularClone(extraArgs);
}

var item = {
Expand Down Expand Up @@ -596,7 +629,7 @@ function addErrorContext(item, errors) {
try {
for (var i = 0; i < errors.length; ++i) {
if (errors[i].hasOwnProperty('rollbarContext')) {
custom = merge(custom, errors[i].rollbarContext);
custom = merge(custom, nonCircularClone(errors[i].rollbarContext));
contextAdded = true;
}
}
Expand Down Expand Up @@ -4546,7 +4579,7 @@ module.exports = {


module.exports = {
version: '2.24.0',
version: '2.24.1',
endpoint: 'api.rollbar.com/api/1/item/',
logLevel: 'debug',
reportLevel: 'debug',
Expand Down
2 changes: 1 addition & 1 deletion dist/rollbar.js.map

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion dist/rollbar.min.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion dist/rollbar.min.js.map

Large diffs are not rendered by default.

43 changes: 38 additions & 5 deletions dist/rollbar.named-amd.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion dist/rollbar.named-amd.js.map

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion dist/rollbar.named-amd.min.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion dist/rollbar.named-amd.min.js.map

Large diffs are not rendered by default.

43 changes: 38 additions & 5 deletions dist/rollbar.noconflict.umd.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion dist/rollbar.noconflict.umd.js.map

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion dist/rollbar.noconflict.umd.min.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion dist/rollbar.noconflict.umd.min.js.map

Large diffs are not rendered by default.

0 comments on commit 1936f98

Please sign in to comment.