Skip to content

Commit 29a8d55

Browse files
throw error instead of promise.reject in attemptTransaction
1 parent 8d84b18 commit 29a8d55

File tree

1 file changed

+1
-3
lines changed

1 file changed

+1
-3
lines changed

src/sessions.ts

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -609,9 +609,7 @@ async function attemptTransaction<T>(
609609

610610
if (!isPromiseLike(promise)) {
611611
await session.abortTransaction().catch(() => null);
612-
return await Promise.reject(
613-
new MongoInvalidArgumentError('Function provided to `withTransaction` must return a Promise')
614-
);
612+
throw new MongoInvalidArgumentError('Function provided to `withTransaction` must return a Promise');
615613
}
616614

617615
try {

0 commit comments

Comments
 (0)