Handling rollback in the next, update, and insert worked fairly well but handling it in commit hasn't worked well.
Instead most functions should return a boolean value for whether the transaction needs rollback or not. This appears to be cleaner in my attempted implementation.