• Alfredo Di Napoli's avatar
    Fix rollaback behavior (issue #480) · 94e2cbf9
    Alfredo Di Napoli authored
    This commit fixes the bug with DbTx rollbacks and domain-specific
    errors. What we do now is throwing an exception during the evaluation of
    `DbFail`, to later catch it _after_ `withTransactionM` has performed a
    clean rollback, and only at that point we call `throwError`.
    
    This also means that we need to catch `DbTx` errors via the `MonadError`
    interface, not via the exception-handling interface, to get proper
    rollback behavior.
    94e2cbf9