Skip to content

Commit

Permalink
feat: Include exception type in igoreErrors test
Browse files Browse the repository at this point in the history
  • Loading branch information
kamilogorek committed Sep 27, 2017
1 parent b28db84 commit 7dc7ce6
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 4 deletions.
8 changes: 5 additions & 3 deletions src/raven.js
Original file line number Diff line number Diff line change
Expand Up @@ -1420,14 +1420,16 @@ Raven.prototype = {
},

_processException: function(type, message, fileurl, lineno, frames, options) {
var stacktrace;
type = type || '';
message = message || '';

if (
!!this._globalOptions.ignoreErrors.test &&
this._globalOptions.ignoreErrors.test(message)
this._globalOptions.ignoreErrors.test(type + ': ' + message)
)
return;

message += '';
var stacktrace;

if (frames && frames.length) {
fileurl = frames[0].filename || fileurl;
Expand Down
4 changes: 3 additions & 1 deletion test/raven.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -478,11 +478,13 @@ describe('globals', function() {
it('should respect `ignoreErrors`', function() {
this.sinon.stub(Raven, '_send');

Raven._globalOptions.ignoreErrors = joinRegExp(['e1', 'e2']);
Raven._globalOptions.ignoreErrors = joinRegExp(['e1', 'e2', 'CustomError']);
Raven._processException('Error', 'e1', 'http://example.com', []);
assert.isFalse(Raven._send.called);
Raven._processException('Error', 'e2', 'http://example.com', []);
assert.isFalse(Raven._send.called);
Raven._processException('CustomError', 'e3', 'http://example.com', []);
assert.isFalse(Raven._send.called);
Raven._processException('Error', 'error', 'http://example.com', []);
assert.isTrue(Raven._send.calledOnce);
});
Expand Down

0 comments on commit 7dc7ce6

Please sign in to comment.