Am Sa, 2004-11-20 um 08.31 schrieb Craig McClanahan:
> On Fri, 19 Nov 2004 23:21:02 -0800, Daniel Rall <[EMAIL PROTECTED]> wrote:
> > On Fri, 2004-10-29 at 13:35 -0400, Henri Yandell wrote:
> > ...
> > > How about just being able to do multiple Exceptions in one block?
> > >
> > > try {
> > >      ....
> > > } catch(JMSException, RemoteException, SQLException e) {
> > > }
> > >
> > > or possibly even:
> > >
> > > try {
> > >      ....
> > > } catch( (JMSException | RemoteException | SQLException) e) {
> > > }
> > 
> > Something like this would be truly excellent.  I'm so sick of having to
> > write 30 lines of exception handling code.
> 
> How about two lines, which you can already do today?
> 
> try {
>   ...
> } catch (Exception e) {
>   ...
> }

Craig,

I wouldn't have expected that answer from you. :-)

Usually you don't want to just catch all exceptions in a single block.
Instead you want to have clusters of exceptions like in the example
quoted above, and you want to handle each cluster of exceptions
differently.

And often the exception types you'd like to cluster don't have a
sensible inheritance relation other than that they subclass from
Exception.

Yes, we do need another catching syntax between the two extremes "catch
everything in one" and "catch each exception type separately".

Best regards
Rainer Klute

                           Rainer Klute IT-Consulting GmbH
  Dipl.-Inform.
  Rainer Klute             E-Mail:  [EMAIL PROTECTED]
  Körner Grund 24          Telefon: +49 172 2324824
D-44143 Dortmund           Telefax: +49 231 5349423

Softwarepatente verhindern: http://www.nosoftwarepatents.com/


---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to