Eric said:
try { something } catch (Throwable t) { whatever }
Note that this will catch a lot of things few sane
programs would want to catch. A more likely formula is
try { something } catch (Exception e) { whatever }
To add to Eric's reply, please be careful about doing this. The
exception handling mechanism is specifically designed to let you do
something about specific exceptions that you are anticipating, and pass
by other exceptions that you aren't. It's goo to use that facility as
designed. There's a huge temptation, when catching a superclass like
Exception or Throwable, to *assume* that the exception you just caught
is one that you were anticipating, but that may not be the case.
Remember that Exception includes things like NullPointerException or
ArrayIndexOutOfBoundsException, which are often entirely unexpected;
Throwable includes things like InternalError, which are even less
expected and even more dangerous if you try to go on without
understanding why they occurred.
In other words, your program crashing is *not* the worst thing that
could happen. The worst thing that could happen is for your program to
break and you to not find out about it because you put in overly-zealous
error handling.
--
www.designacourse.com
The Easiest Way to Train Anyone... Anywhere.
Chris Smith - Lead Software Developer/Technical Trainer
MindIQ Corporation