On 05/11/2012 06:44 PM, Ramiro Pereira de Magalhães wrote:
I'm also favorable to specific exceptions, but I would like to
see
them under a meaninful class hierarchy. TaskException could be the
parent class of many others. This would simplify a lot the exception
handling.
I think this is already the case.
Also, make them RuntimeExceptions. First, because you already put in
the method a statement declaring what exceptions it may throw, so the
exception handling "protocol" is already clear to client software
developers. Second, you won't break backwards compatibility (not sure
if that has any practical effects). Third, there are those times when
you just want to write a quick sample code and don't want to deal
(yet) with exceptions.
Yes, for those two reasons, backwards compatibility and not
having to
catch exceptions every time for simple cases, my vote would be to make
them runtime exceptions as well.
Kris