Tidy up the handling of errors on the transaction.