1
1
/* eslint-disable github/no-then */
2
- import { promisify } from 'util' ;
3
2
4
3
import { Binary , type Document , Long , type Timestamp } from './bson' ;
5
4
import type { CommandOptions , Connection } from './cmap/connection' ;
@@ -40,7 +39,6 @@ import {
40
39
import {
41
40
ByteUtils ,
42
41
calculateDurationInMs ,
43
- type Callback ,
44
42
commandSupportsReadConcern ,
45
43
isPromiseLike ,
46
44
List ,
@@ -419,14 +417,14 @@ export class ClientSession extends TypedEventEmitter<ClientSessionEvents> {
419
417
* Commits the currently active transaction in this session.
420
418
*/
421
419
async commitTransaction ( ) : Promise < void > {
422
- return await endTransaction ( this , 'commitTransaction' ) . catch ( e => squashError ( e ) ) ;
420
+ return await endTransaction ( this , 'commitTransaction' ) . catch ( e => e ) ;
423
421
}
424
422
425
423
/**
426
424
* Aborts the currently active transaction in this session.
427
425
*/
428
426
async abortTransaction ( ) : Promise < void > {
429
- return await endTransaction ( this , 'abortTransaction' ) . catch ( e => squashError ( e ) ) ;
427
+ return await endTransaction ( this , 'abortTransaction' ) . catch ( e => e ) ;
430
428
}
431
429
432
430
/**
@@ -659,7 +657,9 @@ async function endTransaction(
659
657
}
660
658
661
659
if ( txnState === TxnState . TRANSACTION_ABORTED ) {
662
- throw new MongoTransactionError ( 'Cannot call commitTransaction after calling abortTransaction' ) ;
660
+ throw new MongoTransactionError (
661
+ 'Cannot call commitTransaction after calling abortTransaction'
662
+ ) ;
663
663
}
664
664
} else {
665
665
if ( txnState === TxnState . STARTING_TRANSACTION ) {
@@ -676,7 +676,9 @@ async function endTransaction(
676
676
txnState === TxnState . TRANSACTION_COMMITTED ||
677
677
txnState === TxnState . TRANSACTION_COMMITTED_EMPTY
678
678
) {
679
- throw new MongoTransactionError ( 'Cannot call abortTransaction after calling commitTransaction' ) ;
679
+ throw new MongoTransactionError (
680
+ 'Cannot call abortTransaction after calling commitTransaction'
681
+ ) ;
680
682
}
681
683
}
682
684
0 commit comments