| Message: 92574 |
 |
BY: Moses Hohman (mmhohman) DATE: 2010-02-05 23:18 SUBJECT: FasterCSV#shift swallows exceptions Hi James,
Thanks for writing FasterCSV, I've gotten a lot of benefit out of it.
One thing continues to bug me about it, and I thought I'd ask whether it was intentional. In FasterCSV#shift at the beginning of the loop, you have:
begin
line += @io.gets(@row_sep)
rescue
return nil
end
i.e. you swallow any exception that might occur and just return nil. There are cases where I want to know what that exception was, but I have no opportunity.
I would suggest you change this to:
if read_line = @io.gets(@row_sep)
line += read_line
else
return nil
end
All of your tests still pass with that code, except for one that had a small error in it (hidden by the exception swallowing), tc_interface.rb's test_write_hash should open the csv for reading the second time...
Hope this is helpful,
Moses
| |