File tree 2 files changed +33
-4
lines changed
2 files changed +33
-4
lines changed Original file line number Diff line number Diff line change @@ -583,9 +583,6 @@ Rollbar.prototype.setupUnhandledCapture = function () {
583
583
} ;
584
584
585
585
Rollbar . prototype . handleUncaughtExceptions = function ( ) {
586
- var exitOnUncaught = ! ! this . options . exitOnUncaughtException ;
587
- delete this . options . exitOnUncaughtException ;
588
-
589
586
addOrReplaceRollbarHandler ( 'uncaughtException' , function ( err ) {
590
587
if ( ! this . options . captureUncaught && ! this . options . handleUncaughtExceptions ) {
591
588
return ;
@@ -597,7 +594,7 @@ Rollbar.prototype.handleUncaughtExceptions = function () {
597
594
logger . error ( err ) ;
598
595
}
599
596
} ) ;
600
- if ( exitOnUncaught ) {
597
+ if ( this . options . exitOnUncaughtException ) {
601
598
setImmediate ( function ( ) {
602
599
this . wait ( function ( ) {
603
600
process . exit ( 1 ) ;
Original file line number Diff line number Diff line change @@ -550,6 +550,38 @@ vows.describe('rollbar')
550
550
assert . equal ( logStub . getCall ( 0 ) . args [ 0 ] . err . message , 'node error' ) ;
551
551
}
552
552
notifier . log . restore ( ) ;
553
+ } ,
554
+ 'exitOnUncaughtException' : {
555
+ topic : function ( ) {
556
+ var rollbar = new Rollbar ( {
557
+ accessToken : 'abc123' ,
558
+ captureUncaught : true ,
559
+ exitOnUncaughtException : true
560
+ } ) ;
561
+ rollbar . exitStub = sinon . stub ( process , 'exit' ) ;
562
+
563
+ nodeThrow ( rollbar , this . callback ) ;
564
+ } ,
565
+ 'should exit' : function ( r ) {
566
+ var calls = r . exitStub . getCalls ( ) ;
567
+ r . exitStub . restore ( ) ;
568
+ assert . equal ( calls . length , 1 ) ;
569
+ } ,
570
+ 'unrelated option reconfigured' : {
571
+ topic : function ( r ) {
572
+ r . configure ( {
573
+ environment : 'new-env'
574
+ } ) ;
575
+ r . exitStub = sinon . stub ( process , 'exit' ) ;
576
+
577
+ nodeThrow ( r , this . callback ) ;
578
+ } ,
579
+ 'should exit' : function ( r ) {
580
+ var calls = r . exitStub . getCalls ( ) ;
581
+ r . exitStub . restore ( ) ;
582
+ assert . equal ( calls . length , 1 ) ;
583
+ }
584
+ }
553
585
}
554
586
}
555
587
}
You can’t perform that action at this time.
0 commit comments