Open mdnorman opened 3 months ago
Nice catch (pun intended)! This should be fixed in Kysely.
On the other hand, beginTransaction
can do multiple things. For example mysql creates a transaction and sets the isolation level using a separate query. If the second query fails, we still need to roll back the transaction.
But leaving this up to the driver seems risky too.
At this line, the
beginTransaction
call could fail, throwing an error that gets caught on line 570. The issue we are running into is thatrollbackTransaction
then gets called on a transaction that's not created yet. In the driver we're using, rolling back a transaction that's not created yet is considered an error.I could go either way on this one, so is it a bug in the driver code that
rollbackTransaction
shouldn't throw an error if it's not in a transaction yet, or is it a bug to callrollbackTransaction
when the transaction hasn't been created yet.If the former, I'll go open an issue against the driver to put a fix in. If it's the latter, then I'm hoping it can get fixed here.