Skip to content

Instantly share code, notes, and snippets.

@jhubert
Created March 17, 2017 05:08
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 jhubert/9d34cb3f1f28f320efde9cbf8496b133 to your computer and use it in GitHub Desktop.
Save jhubert/9d34cb3f1f28f320efde9cbf8496b133 to your computer and use it in GitHub Desktop.
require 'csv'
require 'csv-i18n'
require 'i18n'
I18n.backend.store_translations(:en, csv: { exception: { unclosed_quoted_field: "custom error on line %{line_number}" } })
CSV.parse('"')
# lib/ruby/2.3.0/csv.rb:1898:in `block in shift': custom error on line 1 (CSV::MalformedCSVError)
# from lib/ruby/2.3.0/csv.rb:1805:in `loop'
# from lib/ruby/2.3.0/csv.rb:1805:in `shift'
# from lib/ruby/gems/2.3.0/gems/csv-i18n-0.1.1/lib/csv_i18n/ext.rb:6:in `shift'
# from lib/ruby/2.3.0/csv.rb:1747:in `each'
# from lib/ruby/2.3.0/csv.rb:1761:in `to_a'
# from lib/ruby/2.3.0/csv.rb:1761:in `read'
# from lib/ruby/2.3.0/csv.rb:1307:in `parse'
# from app.rb:7:in `<main>'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment