Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Catch all exceptions

Status
Not open for further replies.

mackey333

Technical User
May 10, 2001
563
US
Is there a way to catch all exceptions i.e.:

try
{
blah;
blah2;
whoops;
}
catch (allExceptions n)
{
System.out.println("OH NO!");
} -Greg :-Q

flaga.gif
 
Try this :
try
{
blah;
blah2;
whoops;
}
catch (Throwable n)
{
System.out.println("OH NO!");
}
 
using
Code:
catch (Throwable n)

will catch everthing, including Errors. If you are only after catching Exceptions then you could use
Code:
catch(Exception n)[code]
the catch all possibles exceptions. -------------------------------------------
    There are no onions, only magic
-------------------------------------------
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top