-
Notifications
You must be signed in to change notification settings - Fork 0
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Exception inside block #1
Comments
Manuel, In this version, there is no way to skip a row that fails to validate a Cheers... 2016-06-24 18:45 GMT-03:00 Manuel Aristarán notifications@github.com:
Rodrigo Botafogo |
Making exceptions catchable inside the Thanks! |
Manuel, After I send my e-mail I understood what you meant. I´m working on fixing
This should solve your problem. 2016-06-27 11:34 GMT-03:00 Manuel Aristarán notifications@github.com:
Rodrigo Botafogo |
Manuel, After working for a while, I think that actually my first answer was wrong. begin This should solve your problem. Is that right? 2016-06-24 18:45 GMT-03:00 Manuel Aristarán notifications@github.com:
Rodrigo Botafogo |
Yeah, that solves the problem. However, I find it a bit strange to wrap the entire In my opinion, this feels a bit more natural: reader.read do |ln, rn, row, headers|
begin
writer << row
rescue
# handle exception: skip row, report error, abort, whatever.
end
end |
Hi,
It seems to be impossible to catch an exception inside the block that is passed to
reader#read
. My code looks like this:A row in my CSV contains an invalid value for the
rbd
column, causing jCSV to throw an exceptionIs there anyway to skip a row that fails to validate the filters?
PS: Thanks for this gem! It's making my life a lot easier :)
The text was updated successfully, but these errors were encountered: