What is the difference between catch exception e catch error err and catch throwable t?

Answer

Java Almanac has a good summary.

See http://javaalmanac.com/egs/Java%20Language/CatchThrowable.html?l=new

"All errors and exceptions extend from Throwable. By catching Throwable, it is possible to handle all unexpected conditions.

There are several scenarios where it is good practice to catch Throwable. For example, in a server application, the threads that handle requests should catch Throwable and relay any errors or exceptions to the client. Another scenario is a long-running thread that performs some background activity. Such threads should catch Throwable, log any errors or exceptions, and then continue functioning.

It is rarely good practice for a method in a library to catch Throwable. In general, errors and exceptions should not be masked from the caller."

 

Improve Answer Discuss the question "What is the difference between catch exception e catch error err and catch throwable t?" Watch Question

First answer by ID1087241046. Last edit by ID1087241046. Question popularity: 89 [recommend question]


Research your answer:

Can you answer other questions about programming?

Answers.com > Wiki Answers > Categories > Technology > Computers > Computer Programming > What is the difference between catch exception e catch error err and catch throwable t?

Our contributors said this page should be displayed for the questions below. (Where do these come from)
If any of these are not a genuine rephrasing of the question, please help out and edit these alternates.
Whats the catch?  What is by-catch?  Hoonw to catch umbre?  Where to catch kirlia?  How do you catch Azlef?  How do you catch odish?  How do you catch treecko?  How do you catch touaros?  How do you catch rigigias?  Where do you catch gibles?  Try catch blockin computers?  How do you catch arceuspokemon?  Where can you catch a metagross?  How do you get a treecko when you got a blazeiken?  What is the difference between catch Exception e throw e and catch Exception e throw?