On Tue, 25 Oct 2016 10:37:13 -0700, Gary Gregory wrote:
Using RE is a no-no, so we need to do _something_

The code already suggests using an ISE:

                    // TODO: This is not great, throw an ISE instead?
                    throw new RuntimeException(e);

Curious: Why is adding a custom exception better that ISE? The question will then be "Why do we not throw the custom exception all over instead of
JRE exceptions?"

public class CSVParsingException extends IllegalStateException { /* ... */ }

Gilles


Gary

On Tue, Oct 25, 2016 at 7:56 AM, Jochen Wiedmann <jochen.wiedm...@gmail.com>
wrote:

On Tue, Oct 25, 2016 at 4:45 PM, Gary Gregory <garydgreg...@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" <brit...@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-unsubscr...@commons.apache.org
For additional commands, e-mail: dev-h...@commons.apache.org




--
E-Mail: garydgreg...@gmail.com | ggreg...@apache.org
Java Persistence with Hibernate, Second Edition

<https://www.amazon.com/gp/product/1617290459/ref=as_li_tl?ie=UTF8&camp=1789&creative=9325&creativeASIN=1617290459&linkCode=as2&tag=garygregory-20&linkId=cadb800f39946ec62ea2b1af9fe6a2b8>


<http:////ir-na.amazon-adsystem.com/e/ir?t=garygregory-20&l=am2&o=1&a=1617290459>
JUnit in Action, Second Edition

<https://www.amazon.com/gp/product/1935182021/ref=as_li_tl?ie=UTF8&camp=1789&creative=9325&creativeASIN=1935182021&linkCode=as2&tag=garygregory-20&linkId=31ecd1f6b6d1eaf8886ac902a24de418%22>


<http:////ir-na.amazon-adsystem.com/e/ir?t=garygregory-20&l=am2&o=1&a=1935182021>
Spring Batch in Action

<https://www.amazon.com/gp/product/1935182951/ref=as_li_tl?ie=UTF8&camp=1789&creative=9325&creativeASIN=1935182951&linkCode=%7B%7BlinkCode%7D%7D&tag=garygregory-20&linkId=%7B%7Blink_id%7D%7D%22%3ESpring+Batch+in+Action>

<http:////ir-na.amazon-adsystem.com/e/ir?t=garygregory-20&l=am2&o=1&a=1935182951>
Blog: http://garygregory.wordpress.com
Home: http://garygregory.com/
Tweet! http://twitter.com/GaryGregory


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

Reply via email to