Mastering Exception

Mastering Exception

When you are working with the structured exception handling keep some points in your mind:

Break down your code into multiple try/catch blocks
If you kept all your code into one exception handler, you will have to face trouble in determining where the problem occurred. You have no way to “resume“ the code in a try block. This means that if an error occurs at the beginning of a lengthy try block, you will skip a large amount of code.

Report all errors
During Debugging, the part of your applications error-handling code may hide easily and can correct mistakes in your application.

Don’t use Exception handlers for every statement
Error handling should be used when you are accessing an outside resource.A Simple code may cause errors during development testing but will not cause any future problems.

Scroll to Top