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
This commit is contained in:
@ -32,9 +32,10 @@ finally {
|
|||||||
// block of code to be executed after try block ends
|
// block of code to be executed after try block ends
|
||||||
}
|
}
|
||||||
```
|
```
|
||||||
|
|
||||||
## Advantage of Exception Handling
|
## 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.
|
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:
|
#### More Information:
|
||||||
- [Oracle Java Docs : Exception](https://docs.oracle.com/javase/specs/jls/se7/html/jls-11.html)
|
- [Oracle Java Docs : Exception](https://docs.oracle.com/javase/specs/jls/se7/html/jls-11.html)
|
||||||
|
Reference in New Issue
Block a user