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) {
  ...
}

If you really want to treat different types of exceptions differently,
you can special case by putting specialized catch blocks for the
special cases in front of this.  The predominant use case, though,
seems to be a standarized "log it and exit" or "log it and rethrow it
in a wrapper exception" strategy, which you can deal with quite
easily.

Sheesh, hasn't anyone ever heard of inheritance around here?  :-)

Craig

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

Reply via email to