Exception Handling Basics
The exception is an event that occurs during the execution of a program and
it requires the execution of code outside the normal flow of control. There
are two kinds of exceptions:
1. Hardware exceptions that are initiated by the CPU. They can result from
the execution of certain instruction sequences (e.g. division by zero or an attempt
to access an invalid memory address).
2. Software exceptions that are initiated explicitly by applications or by
the operating system. (e.g. the system can detect when an invalid parameter value
is specified).
Because Visual Basic doesn't offer built-in support for handling anomalous situations,
you should use the MExceptionHandler module (or anything similar) that implements
code for filtering any unhandled exceptions that may occur during a program's execution.
In this way your program can communicate unexpected events to a higher execution
context that is able to recover from such abnormal events. Also, handling
exceptions ensures that a termination code containing clean-up tasks is executed
even if an exception or some other error occurs while the code is being executed.
See also
Back To Top
|