mirror of
https://github.com/doctrine/orm.git
synced 2026-03-23 22:42:18 +01:00
[PR #11482] Catch Rollback Driver Exception #13055
Reference in New Issue
Block a user
Delete Branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Original Pull Request: https://github.com/doctrine/orm/pull/11482
State: closed
Merged: No
Adds a try/catch when rolling back after an exception during UnitOfWork commit, so exception is not lost.
Currently the connection driver could throw an exception on rollback (eg. if the exception causes there to be no active transaction) which results in the driver exception propagating to the caller, and the commit Throwable being lost. Instead here, the rollback exception is swallowed so the original commit exception can be thrown to the caller.
I'm not sure what the best behaviour is here, so please advise. I've also not added any tests yet as it looked like I'd need to do some wrangling on the mocks being used, so wanted to at least check this was a reasonable idea before spending time on it.