You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
In Ruby 2.5, CSV::MalformedCSVError simply inherited from RuntimeError. In 2.6, it defines its own #new, taking 2 arguments (as opposed to the single argument of RuntimeError).
Code explicitly raising new errors of this class outside of the CSV library implementation itself breaks since it doesn't include the second argument (a line number).
Is making the line number optional something you'd entertain?
Thanks.
It seems that it's an application specific error and it's not a general CSV error. So you should use your own error class instead of reusing CSV::MalformedCSVError.
@kou okay, thanks, I will take note and we will discuss it with colleagues. We've just got this error while ruby update. Now we'got how to resolve it. Thank you
Activity
kou commentedon Sep 2, 2019
Could you show codes that creating
CSV::MalformedCSVError
?Mifrill commentedon Oct 11, 2019
@kou just this:
with 2.6 ruby it's raised this:
because of this:
36e1cb2
csv/lib/csv.rb
Lines 212 to 219 in 36e1cb2
For Ruby 2.5 code was without required arguments:
https://bugs.ruby-lang.org/issues/16133
kou commentedon Oct 11, 2019
Thanks.
One more question. Why do you want to raise
CSV::MalformedCSVError
manually?Mifrill commentedon Oct 11, 2019
@kou well, in our specific case, we have a logic with check of valid headers
So, I'm thinking about this error like a any error of CSV parsing, like a it's an explicit error, which was inherited from
RuntimeError
.kou commentedon Oct 11, 2019
Thanks.
It seems that it's an application specific error and it's not a general CSV error. So you should use your own error class instead of reusing
CSV::MalformedCSVError
.Mifrill commentedon Oct 11, 2019
@kou okay, thanks, I will take note and we will discuss it with colleagues. We've just got this error while ruby update. Now we'got how to resolve it. Thank you
kou commentedon Oct 11, 2019
OK. I close this.