In the few rare cases that these "exceptions" are truly privileged, and
absolutely *must* be brought to the attention of the API user, doesn't it
make more sense to do this explicitly via the normal return path? Something
akin to the Either type in Scala or Haskell:
public Either<ResultSet, SqlError> myDatabaseFunction(String param) {
...
}
Exceptions should be things that are truly exceptional. Almost by
definition, this sort of problem can rarely be dealt with at a low level.
2010/9/21 Cédric Beust ♔ <[email protected]>
>
>
> On Tue, Sep 21, 2010 at 3:26 PM, [email protected] <
> [email protected]> wrote:
>
>> And you hit this point "Here is what most people fundamentally don't
>> understand about checked exceptions: they are rare. Most of the
>> exceptions are not recoverable, so they should be unchecked. "
>>
>> They are rare? Well maybe they SHOULD be rare, but they aren't.
>> SQLException certainly comes to mind. 99% of the time you hit a
>> SQLException or IOException you can't do anything to solve the
>> problem.
>>
>
> That's exactly why I said that so few people understand checked exceptions.
> The developers who wrote these methods and decided that they should throw
> checked exceptions clearly didn't understand this, and they contributed
> greatly to giving this bad image to checked exceptions.
>
> You are pointing out a bad usage of checked exceptions, not invalidating
> the concept.
>
> I think we are in agreement that checked exceptions should be rare, but
> they should be *allowed* because in the few cases where they are useful,
> they are *really* useful.
>
> --
> Cédric
>
>
> --
> You received this message because you are subscribed to the Google Groups
> "The Java Posse" group.
> To post to this group, send email to [email protected].
> To unsubscribe from this group, send email to
> [email protected]<javaposse%[email protected]>
> .
> For more options, visit this group at
> http://groups.google.com/group/javaposse?hl=en.
>
--
Kevin Wright
mail / gtalk / msn : [email protected]
pulse / skype: kev.lee.wright
twitter: @thecoda
--
You received this message because you are subscribed to the Google Groups "The
Java Posse" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to
[email protected].
For more options, visit this group at
http://groups.google.com/group/javaposse?hl=en.