I'm learning java and I don't understand Why should the program error exception never be caught by the application program?
Asked
Active
Viewed 66 times
-3
-
Can you provide a source for where you read that? Are you talking about an *exception* or an *error*? These are two distinct concepts. I assume it is about the latter -- `java.lang.error`? If so: http://stackoverflow.com/questions/11017304/catching-java-errors – Jeroen Vannevel Feb 09 '16 at 00:53
-
Your question doesn't include enough detail to answer. Who says and in what context? – Elliott Frisch Feb 09 '16 at 00:53
-
Can you post the exact quote you found? I have no clue what you mean by "program error exceptions". If you mean system exceptions, like `OutOfMemoryError`, they should only be caught in certain circumstances, if at all. – Amadan Feb 09 '16 at 00:54
1 Answers
1
Why should the program error exception never be caught by the application program?
You should only catch Exception/Errors at the point when you can handle and recover from them. Error
s are usually too serious to be able to handle and recover from. Never the less, you can catch them in rare case, esp if you want to log them.

Peter Lawrey
- 525,659
- 79
- 751
- 1,130