File tree Expand file tree Collapse file tree 2 files changed +19
-0
lines changed Expand file tree Collapse file tree 2 files changed +19
-0
lines changed Original file line number Diff line number Diff line change @@ -261,6 +261,13 @@ var Raven = {
261
261
* @return {Raven }
262
262
*/
263
263
captureMessage : function ( msg , options ) {
264
+ // config() automagically converts ignoreErrors from a list to a RegExp so we need to test for an
265
+ // early call; we'll error on the side of logging anything called before configuration since it's
266
+ // probably something you should see:
267
+ if ( ! ! globalOptions . ignoreErrors . test && globalOptions . ignoreErrors . test ( msg ) ) {
268
+ return ;
269
+ }
270
+
264
271
// Fire away!
265
272
send (
266
273
objectMerge ( {
Original file line number Diff line number Diff line change @@ -1594,6 +1594,18 @@ describe('Raven (public API)', function() {
1594
1594
Raven . captureMessage ( 'lol' ) ;
1595
1595
assert . equal ( Raven . lastEventId ( ) , 'abc123' ) ;
1596
1596
} ) ;
1597
+
1598
+ it ( 'should respect `ignoreErrors`' , function ( ) {
1599
+ this . sinon . stub ( window , 'send' ) ;
1600
+
1601
+ globalOptions . ignoreErrors = joinRegExp ( [ 'e1' , 'e2' ] ) ;
1602
+ Raven . captureMessage ( 'e1' ) ;
1603
+ assert . isFalse ( window . send . called ) ;
1604
+ Raven . captureMessage ( 'e2' ) ;
1605
+ assert . isFalse ( window . send . called ) ;
1606
+ Raven . captureMessage ( 'Non-ignored error' ) ;
1607
+ assert . isTrue ( window . send . calledOnce ) ;
1608
+ } ) ;
1597
1609
} ) ;
1598
1610
1599
1611
describe ( '.captureException' , function ( ) {
You can’t perform that action at this time.
0 commit comments