There are
three different types of errors you can encounter in your
applications: compile-time errors, runtime errors, and logic
errors.
Compile-time errors occur during the construction of your
application. These errors consist mostly of syntax mistakes,
variable scoping problems, or data typing problems. In VBA, these
types of errors are caught by the development environment. When you
enter an incorrect line of code, the line is highlighted and an
error message appears telling you the problem. Compile-time errors
must be corrected before the application can run.
Runtime errors are a little more difficult to find and correct.
They occur during the execution of your code, and often involve
receiving information from the user. For example, if your
application requires the user to enter the name of a drawing and
the user enters a name for a drawing that didn't exist, a runtime
error occurs. To handle runtime errors effectively, you must
predict what kinds of problems could happen, trap them, and then
write code to handle these situations.
Logic errors are the most difficult to find and correct.
Symptoms of logic errors include situations in which there are no
compile-time errors and no runtime errors, but the outcome of your
program is still incorrect. This is what programmers refer to as a
bug—and a bug can be very easy or very difficult to track
down.
Information on
finding and correcting all three types of errors can be found in
documentation for your development environment. AutoCAD-specific
errors fall into the runtime error category, so these types of
errors will be covered more fully in this documentation.