@@ -113,6 +113,13 @@ export class TransactionOrchestrator extends EventEmitter {
113113 }
114114 }
115115
116+ private static isExpectedError ( error : Error ) : boolean {
117+ return (
118+ SkipCancelledExecutionError . isSkipCancelledExecutionError ( error ) ||
119+ SkipExecutionError . isSkipExecutionError ( error )
120+ )
121+ }
122+
116123 static clone ( orchestrator : TransactionOrchestrator ) : TransactionOrchestrator {
117124 return new TransactionOrchestrator ( {
118125 id : orchestrator . id ,
@@ -525,10 +532,7 @@ export class TransactionOrchestrator extends EventEmitter {
525532 try {
526533 await transaction . saveCheckpoint ( )
527534 } catch ( error ) {
528- if (
529- ! SkipCancelledExecutionError . isSkipCancelledExecutionError ( error ) &&
530- ! SkipExecutionError . isSkipExecutionError ( error )
531- ) {
535+ if ( ! TransactionOrchestrator . isExpectedError ( error ) ) {
532536 throw error
533537 }
534538
@@ -583,10 +587,7 @@ export class TransactionOrchestrator extends EventEmitter {
583587 try {
584588 await transaction . saveCheckpoint ( )
585589 } catch ( error ) {
586- if (
587- ! SkipCancelledExecutionError . isSkipCancelledExecutionError ( error ) &&
588- ! SkipExecutionError . isSkipExecutionError ( error )
589- ) {
590+ if ( ! TransactionOrchestrator . isExpectedError ( error ) ) {
590591 throw error
591592 }
592593
@@ -764,10 +765,7 @@ export class TransactionOrchestrator extends EventEmitter {
764765 try {
765766 await transaction . saveCheckpoint ( )
766767 } catch ( error ) {
767- if (
768- ! SkipCancelledExecutionError . isSkipCancelledExecutionError ( error ) &&
769- ! SkipExecutionError . isSkipExecutionError ( error )
770- ) {
768+ if ( ! TransactionOrchestrator . isExpectedError ( error ) ) {
771769 throw error
772770 }
773771
@@ -830,7 +828,7 @@ export class TransactionOrchestrator extends EventEmitter {
830828 } )
831829
832830 await transaction . saveCheckpoint ( ) . catch ( ( error ) => {
833- if ( SkipExecutionError . isSkipExecutionError ( error ) ) {
831+ if ( TransactionOrchestrator . isExpectedError ( error ) ) {
834832 continueExecution = false
835833 return
836834 }
@@ -900,7 +898,7 @@ export class TransactionOrchestrator extends EventEmitter {
900898 }
901899
902900 await transaction . saveCheckpoint ( ) . catch ( ( error ) => {
903- if ( ! SkipExecutionError . isSkipExecutionError ( error ) ) {
901+ if ( ! TransactionOrchestrator . isExpectedError ( error ) ) {
904902 throw error
905903 }
906904 } )
@@ -1063,7 +1061,7 @@ export class TransactionOrchestrator extends EventEmitter {
10631061 await this . handleStepSuccess ( transaction , step , response )
10641062 } )
10651063 . catch ( async ( error ) => {
1066- if ( SkipExecutionError . isSkipExecutionError ( error ) ) {
1064+ if ( TransactionOrchestrator . isExpectedError ( error ) ) {
10671065 return
10681066 }
10691067
@@ -1112,7 +1110,7 @@ export class TransactionOrchestrator extends EventEmitter {
11121110 }
11131111 } )
11141112 . catch ( async ( error ) => {
1115- if ( SkipExecutionError . isSkipExecutionError ( error ) ) {
1113+ if ( TransactionOrchestrator . isExpectedError ( error ) ) {
11161114 return
11171115 }
11181116
0 commit comments