Created
June 17, 2016 23:12
-
-
Save alex-kovshovik/a5e312277e9f9e5c518087715c266469 to your computer and use it in GitHub Desktop.
Ruby exceptions 2
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
def export_to_csv(csv, record) | |
row = [] | |
row << record.id | |
row << record.title | |
row << record.owner.name | |
row << record.get_validation_data(RecordValidator.instance) | |
# More boring-ass code like that here. | |
# ... | |
rescue Exception => ex | |
error = Exception.new("#{ex.message}, on #{record.class} ID #{record.id}") | |
error.set_backtrace(ex.backtrace) | |
raise error | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment