diff --git a/src/raven.js b/src/raven.js index 84b007afcb65..a509bf9b2e52 100644 --- a/src/raven.js +++ b/src/raven.js @@ -603,7 +603,7 @@ function extractContextFromFrame(frame) { function processException(type, message, fileurl, lineno, frames, options) { var stacktrace, i, fullMessage; - if (globalOptions.ignoreErrors.test(message)) return; + if (!!globalOptions.ignoreErrors.test && globalOptions.ignoreErrors.test(message)) return; message += ''; message = truncate(message, globalOptions.maxMessageLength); @@ -627,8 +627,8 @@ function processException(type, message, fileurl, lineno, frames, options) { }; } - if (globalOptions.ignoreUrls && globalOptions.ignoreUrls.test(fileurl)) return; - if (globalOptions.whitelistUrls && !globalOptions.whitelistUrls.test(fileurl)) return; + if (!!globalOptions.ignoreUrls.test && globalOptions.ignoreUrls.test(fileurl)) return; + if (!!globalOptions.whitelistUrls.test && !globalOptions.whitelistUrls.test(fileurl)) return; // Fire away! send( diff --git a/test/raven.test.js b/test/raven.test.js index 499fb9e0ed7e..b5e91f8def4f 100644 --- a/test/raven.test.js +++ b/test/raven.test.js @@ -691,6 +691,14 @@ describe('globals', function() { assert.isTrue(window.send.calledOnce); }); + it('should handle empty `ignoreErrors`', function() { + this.sinon.stub(window, 'send'); + + globalOptions.ignoreErrors = []; + processException('Error', 'e1', 'http://example.com', []); + assert.isTrue(window.send.calledOnce); + }); + it('should respect `ignoreUrls`', function() { this.sinon.stub(window, 'send'); @@ -703,6 +711,14 @@ describe('globals', function() { assert.isTrue(window.send.calledOnce); }); + it('should handle empty `ignoreUrls`', function() { + this.sinon.stub(window, 'send'); + + globalOptions.ignoreUrls = []; + processException('Error', 'e1', 'http://example.com', []); + assert.isTrue(window.send.calledOnce); + }); + it('should respect `whitelistUrls`', function() { this.sinon.stub(window, 'send'); @@ -715,6 +731,14 @@ describe('globals', function() { assert.equal(window.send.callCount, 2); }); + it('should handle empty `whitelistUrls`', function() { + this.sinon.stub(window, 'send'); + + globalOptions.whitelistUrls = []; + processException('Error', 'e1', 'http://example.com', []); + assert.isTrue(window.send.calledOnce); + }); + it('should send a proper payload with frames', function() { this.sinon.stub(window, 'send');