Skip to content

Instantly share code, notes, and snippets.

@alex-kovshovik
Created June 17, 2016 23:12
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save alex-kovshovik/a5e312277e9f9e5c518087715c266469 to your computer and use it in GitHub Desktop.
Save alex-kovshovik/a5e312277e9f9e5c518087715c266469 to your computer and use it in GitHub Desktop.
Ruby exceptions 2
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