Yamanlk / transactional-prisma

"@transactional/prisma" is an npm package that offers a "@Transactional" method decorator for running your queries inside a transaction seamlessly. It achieves this by leveraging AsyncLocalStorage.
8 stars 0 forks source link

Impossible to handle errors from transaction #1

Closed Daimon-EuDaimon closed 5 months ago

Daimon-EuDaimon commented 6 months ago

When an error occurs in a transaction, it is rolled back and the object { Symbol(prisma.client.extension.rollback): true } is thrown. I'd like to receive the error that caused the transaction to be rolled back.

Daimon-EuDaimon commented 6 months ago

I propose this solution, on src/flat-transaction.ts:48 replace return tx; with return tx.catch((e: any) => e[Symbol.for("prisma.client.extension.rollback")] ? undefined : tx);

bytadaniel commented 6 months ago

Hey! I have the same problem. There are some issues with handling errors..

Yamanlk commented 6 months ago

I'll look into it

Yamanlk commented 5 months ago

Fixed in 1.1.1