marley
marley
PPrisma
Created by marley on 6/13/2024 in #help-and-questions
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!
2 replies