[PR #11482] Catch Rollback Driver Exception #13055

Closed
opened 2026-01-22 16:16:02 +01:00 by admin · 0 comments
Owner

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.

**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.
admin added the pull-request label 2026-01-22 16:16:02 +01:00
admin closed this issue 2026-01-22 16:16:02 +01:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: doctrine/archived-orm#13055