P
Prisma6mo ago
marley

Error bubbling in $transaction client

We've written a helper decorator to wrap certain functions in a transaction.
return ((this as DbClass).db as PrismaClient).$transaction(
async (txn) => {
(this as DbClass).db = txn;
return value.apply(this, args);
},
{
timeout: TRANSACTION_TIMEOUT,
maxWait: MAX_WAIT,
}
);
return ((this as DbClass).db as PrismaClient).$transaction(
async (txn) => {
(this as DbClass).db = txn;
return value.apply(this, args);
},
{
timeout: TRANSACTION_TIMEOUT,
maxWait: MAX_WAIT,
}
);
Anytime an error is thrown within the applied method, I end up with a unhandledRejection: Error: . This happens even when all methods are synchronous (e.g. removing the async from async (txn) ). This is preventing me from being able to catch errors from outside the transaction. Please advise on how to proceed, thanks!
0 Replies
No replies yetBe the first to reply to this messageJoin
Want results from more Discord servers?
Add your server