I moved this logic into a method called handle_error and made it part of the commit rescue block, you'll see it further down