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
When the iterator hits a malformed CSV-line, it throws an Exception. However, it does it already on the it.hasNext call, making it impossible for me to skip that line and continue.
I tried to use a boolean in the where-clause, but it seems that the faulty line breaks the iterator so I cannot use that approach either.
Are there other ways to do this, or do we need a fix here?
The text was updated successfully, but these errors were encountered:
kilsbo
changed the title
Exceoptions breaks iteration loops.
Exceptions breaks iteration loops.
Feb 23, 2015
Ok so I was wrong on one thing, it does continue after a failed it.hasNext, however, would like for it to not throw an exception on it.hasNext, but on it.next.
I'm believe I'm seeing another manifestation of this, which is that toStream doesn't behave consistently when parse failures occur. The first attempt to read the stream throws an exception, and then subsequent attempts behave as if the stream just ended before the bad record.
I'm not sure if it's generally acceptable for Streams to throw exceptions, but certainly it seems like it should do so consistently. Alternatively, return Either[SomeError, List[String]] or use a different lazy sequence that supports failure.
I am using the following code:
When the iterator hits a malformed CSV-line, it throws an Exception. However, it does it already on the
it.hasNext
call, making it impossible for me to skip that line and continue.I tried to use a boolean in the where-clause, but it seems that the faulty line breaks the iterator so I cannot use that approach either.
Are there other ways to do this, or do we need a fix here?
The text was updated successfully, but these errors were encountered: