Transaction rollback error catching
I'm using drizzle with TRPC and want my api to give detailed reasons for a rollback. However
tx.rollback()
throws a TransactionRollbackError
, which means the TRPC error is never thrown (i think). This means the client sees an error with message "Rollback", which isn't super descriptive.
Is it safe to catch the drizzle error inside of the transaction and throw a TRPC one instead? Im guessing so but just wanted to check.
3 Replies