Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 10 additions & 0 deletions src/utils.js
Original file line number Diff line number Diff line change
Expand Up @@ -309,6 +309,13 @@ function isOnlyOneTruthy(a, b) {
return !!(!!a ^ !!b);
}

/**
* Returns true if both parameters are undefined
*/
function isBothUndefined(a, b) {
return isUndefined(a) && isUndefined(b);
}

/**
* Returns true if the two input exception interfaces have the same content
*/
Expand All @@ -320,6 +327,9 @@ function isSameException(ex1, ex2) {

if (ex1.type !== ex2.type || ex1.value !== ex2.value) return false;

// in case both stacktraces are undefined, we can't decide so default to false
if (isBothUndefined(ex1.stacktrace, ex2.stacktrace)) return false;

return isSameStacktrace(ex1.stacktrace, ex2.stacktrace);
}

Expand Down
8 changes: 8 additions & 0 deletions test/raven.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -3431,6 +3431,14 @@ describe('Raven (private methods)', function() {
data.exception.values[0].stacktrace.frames = [];
assert.isFalse(Raven._isRepeatData(data));
});

it('should not blown if both stacktraces are undefined', function() {
Raven._lastData.exception.values[0].stacktrace = undefined;
var data1 = JSON.parse(JSON.stringify(Raven._lastData)); // copy
var data2 = JSON.parse(JSON.stringify(Raven._lastData)); // copy
assert.isFalse(Raven._isRepeatData(data1));
assert.isFalse(Raven._isRepeatData(data2));
});
});
});
});
Expand Down