Handling unknown exceptions (#23587)

* Handling unknown exceptions

What to do when you do not know what kind of exceptions may be thrown by your application.

* Added code formatting
pull/24109/head^2
ShashwathJS 2018-12-07 14:14:49 +05:30 committed by Manish Giri
parent 3eb4f43c6d
commit 2a2598074e
1 changed files with 2 additions and 1 deletions

View File

@ -32,9 +32,10 @@ finally {
// block of code to be executed after try block ends
}
```
## Advantage of Exception Handling
The core advantage of exception handling is to maintain the normal flow of the application. An exception normally disrupts the normal flow of the application which is why we use exception handling.
Tip: If you are not really sure of what kind of exceptions your application may throw, use the `Exception` parent class to catch any anomaly and use the `stacktrace()` function on the `Exception` object to debug what went wrong.
#### More Information:
- [Oracle Java Docs : Exception](https://docs.oracle.com/javase/specs/jls/se7/html/jls-11.html)