>> But I think it looks a bit cleaner if the variable could be omitted,
>> if it's not needed ;-)
>
> I don't think we need to change the language because Netbeans can't
> figure out how catch blocks work.

The Netbeans thing was just an example/addition.

> It's not used by you - which btw is usually not a good idea - if you've
> got an exception, you usually should somehow react to it - at least log
> it or something, that's what the exceptions are for, if the situation
> does not require special handling it shouldn't be an exception. But it

If you have an exception like `BadCredentialsException` and throw it during 
authentication if the user has entered wrong login data, than you have such a 
situation right?
But do you need any further information? No - in the catch block it may be 
enough to create a message for the user saying: "wrong username or password".

Maybe you only use generic exceptions like `RuntimeException`. This can be an 
exception for almost everything. But if you have defined an exception for one 
special case, to interrupt your code, and catch such an exception you will 
always know why this exception has been thrown.
--
Christian Stoller
LEONEX Internet GmbH

Reply via email to