commons-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Jochen Wiedmann <jochen.wiedm...@gmail.com>
Subject Re: [CSV] Throw custom runtime exception from iterator.next()?
Date Tue, 25 Oct 2016 14:56:58 GMT
On Tue, Oct 25, 2016 at 4:45 PM, Gary Gregory <garydgregory@gmail.com> wrote:
> Or IllegalStateExecption?

Bit generic, and not to be used inflationary. I'd clearly prefer a
custom RuntimeException, as suggested by Benedikt.

> On Oct 25, 2016 2:31 AM, "Benedikt Ritter" <britter@apache.org> wrote:
>
>> Hi,
>>
>> in our iterator implementation returned by CSVParser.iterator() we wrap
>> IOExceptions into RuntimeExceptions because we cannot throw IOException
>> from the iterator methods. For this reason, user code has to catch
>> RuntimeException in order to recover from parsing failures.
>> I was thinking whether it would be better to define a custom
>> RuntimeException, say CSVParsingException extends RuntimeException so user
>> code can only react to this kind of failures.
>>
>> WDYT?
>>
>> Benedikt
>>



-- 
The next time you hear: "Don't reinvent the wheel!"

http://www.keystonedevelopment.co.uk/wp-content/uploads/2014/10/evolution-of-the-wheel-300x85.jpg

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@commons.apache.org
For additional commands, e-mail: dev-help@commons.apache.org


Mime
View raw message