diff --git a/src/utils.js b/src/utils.js index 92a9f475d88a..61c51367c59a 100644 --- a/src/utils.js +++ b/src/utils.js @@ -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 */ @@ -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); } diff --git a/test/raven.test.js b/test/raven.test.js index 486881310d80..9814522c29d0 100644 --- a/test/raven.test.js +++ b/test/raven.test.js @@ -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)); + }); }); }); });