Skip to content

Commit 304a4d6

Browse files
no squashing
1 parent 27e049c commit 304a4d6

File tree

1 file changed

+8
-6
lines changed

1 file changed

+8
-6
lines changed

src/sessions.ts

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
/* eslint-disable github/no-then */
2-
import { promisify } from 'util';
32

43
import { Binary, type Document, Long, type Timestamp } from './bson';
54
import type { CommandOptions, Connection } from './cmap/connection';
@@ -40,7 +39,6 @@ import {
4039
import {
4140
ByteUtils,
4241
calculateDurationInMs,
43-
type Callback,
4442
commandSupportsReadConcern,
4543
isPromiseLike,
4644
List,
@@ -419,14 +417,14 @@ export class ClientSession extends TypedEventEmitter<ClientSessionEvents> {
419417
* Commits the currently active transaction in this session.
420418
*/
421419
async commitTransaction(): Promise<void> {
422-
return await endTransaction(this, 'commitTransaction').catch(e => squashError(e));
420+
return await endTransaction(this, 'commitTransaction').catch(e => e);
423421
}
424422

425423
/**
426424
* Aborts the currently active transaction in this session.
427425
*/
428426
async abortTransaction(): Promise<void> {
429-
return await endTransaction(this, 'abortTransaction').catch(e => squashError(e));
427+
return await endTransaction(this, 'abortTransaction').catch(e => e);
430428
}
431429

432430
/**
@@ -659,7 +657,9 @@ async function endTransaction(
659657
}
660658

661659
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+
);
663663
}
664664
} else {
665665
if (txnState === TxnState.STARTING_TRANSACTION) {
@@ -676,7 +676,9 @@ async function endTransaction(
676676
txnState === TxnState.TRANSACTION_COMMITTED ||
677677
txnState === TxnState.TRANSACTION_COMMITTED_EMPTY
678678
) {
679-
throw new MongoTransactionError('Cannot call abortTransaction after calling commitTransaction');
679+
throw new MongoTransactionError(
680+
'Cannot call abortTransaction after calling commitTransaction'
681+
);
680682
}
681683
}
682684

0 commit comments

Comments
 (0)