@@ -417,14 +417,14 @@ export class ClientSession extends TypedEventEmitter<ClientSessionEvents> {
417
417
* Commits the currently active transaction in this session.
418
418
*/
419
419
async commitTransaction ( ) : Promise < void > {
420
- return await endTransaction ( this , 'commitTransaction' ) . catch ( e => e ) ;
420
+ return await endTransaction ( this , 'commitTransaction' ) ;
421
421
}
422
422
423
423
/**
424
424
* Aborts the currently active transaction in this session.
425
425
*/
426
426
async abortTransaction ( ) : Promise < void > {
427
- return await endTransaction ( this , 'abortTransaction' ) . catch ( e => e ) ;
427
+ return await endTransaction ( this , 'abortTransaction' ) ;
428
428
}
429
429
430
430
/**
@@ -733,7 +733,9 @@ async function endTransaction(
733
733
}
734
734
}
735
735
736
- throw error ;
736
+ if ( error != null ) {
737
+ throw error ;
738
+ }
737
739
}
738
740
739
741
if ( session . transaction . recoveryToken ) {
@@ -757,15 +759,20 @@ async function endTransaction(
757
759
} ) ;
758
760
}
759
761
760
- await executeOperation (
761
- session . client ,
762
- new RunAdminCommandOperation ( command , {
763
- session,
764
- readPreference : ReadPreference . primary ,
765
- bypassPinningCheck : true
766
- } )
767
- ) . catch ( e => commandHandler ( e ) ) ;
768
- commandHandler ( ) ;
762
+ try {
763
+ await executeOperation (
764
+ session . client ,
765
+ new RunAdminCommandOperation ( command , {
766
+ session,
767
+ readPreference : ReadPreference . primary ,
768
+ bypassPinningCheck : true
769
+ } )
770
+ ) ;
771
+ commandHandler ( ) ;
772
+ } catch ( e ) {
773
+ commandHandler ( e ) ;
774
+ }
775
+ return ;
769
776
}
770
777
commandHandler ( error ) ;
771
778
} ;
0 commit comments