File tree Expand file tree Collapse file tree 2 files changed +33
-4
lines changed Expand file tree Collapse file tree 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 () {
583583} ;
584584
585585Rollbar . prototype . handleUncaughtExceptions = function ( ) {
586- var exitOnUncaught = ! ! this . options . exitOnUncaughtException ;
587- delete this . options . exitOnUncaughtException ;
588-
589586 addOrReplaceRollbarHandler ( 'uncaughtException' , function ( err ) {
590587 if ( ! this . options . captureUncaught && ! this . options . handleUncaughtExceptions ) {
591588 return ;
@@ -597,7 +594,7 @@ Rollbar.prototype.handleUncaughtExceptions = function () {
597594 logger . error ( err ) ;
598595 }
599596 } ) ;
600- if ( exitOnUncaught ) {
597+ if ( this . options . exitOnUncaughtException ) {
601598 setImmediate ( function ( ) {
602599 this . wait ( function ( ) {
603600 process . exit ( 1 ) ;
Original file line number Diff line number Diff line change @@ -550,6 +550,38 @@ vows.describe('rollbar')
550550 assert . equal ( logStub . getCall ( 0 ) . args [ 0 ] . err . message , 'node error' ) ;
551551 }
552552 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+ }
553585 }
554586 }
555587 }
You can’t perform that action at this time.
0 commit comments