||Execute statements and catch resulting errors|
||Capture error information|
When a program throws an exception, information about
what caused the error is captured in an
If you catch the exception before your program aborts, you can access
the information. You can also create
that you use to throw exceptions in your code.
Detect conditions that keep your program from completing as expected or generate erroneous results, and then halt execution and throw an exception that reports the error.
To handle an exception appropriately for a particular
condition, capture information about the exception with a
and then execute code to deal with the situation.
It is a good programming practice to include error checking in your programs to ensure reliable operation under all conditions. You can decide how your programs respond to different types of errors.