Last active
August 29, 2015 13:56
-
-
Save RichardJordan/9058865 to your computer and use it in GitHub Desktop.
Example: error handling
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# from this blog post: http://bugroll.com/how-to-write-good-error-messages.html | |
# an example of good error handling | |
begin | |
update_purchase_captured_at!(purchase, captured_at) | |
rescue Exception => e | |
Honeybadger.notify(e) | |
Rails.logger.error(%Q{\ | |
[#{Time.zone.now}][rake purchases:update_captured_at] Error updating \ | |
captured_at for purchase #{purchase.id}: #{e.class}: #{e.message} | |
This means the funds got captured, but the order will *not* be fulfilled! | |
Visit http://thepaymentprocess.com/admin and search for transaction ID | |
#{purchase.transaction_id} for more details on this purchase. | |
#{e.backtrace}}) | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment