Show Contents / Index / Search

Handling Errors

It is recommended that you always include some form of error handling in your macros to deal with runtime errors. Without any error handling, a runtime error causes a macro to stop immediately, and gives the user little information.

There are the three types of errors you may encounter as you program in Reflection 2008:

Error type

Description

Compile

Prevents your macros from running, and typically results from errors in syntax.

Programming logic

Occurs when your macro does not function as expected — the programming syntax is correct, the macro compiles, but an error in logic causes the macro to produce unexpected or incorrect results.

The debugging tools in the Visual Basic Editor can help you track down logic errors. (Search for debugging code in the Visual Basic Editor Help index for more information.)

Runtime

Occurs as your macro runs, and typically results from specific conditions present at that time. For example, if you prompt the user for a host name, and attempt to connect to that host, but the host is not available, the Connect method fails and Visual Basic generates a runtime error.

Note: To determine the meaning of specific error codes, see Error Codes.

In this section

Trapping Runtime Errors

Error-Handling Routines

Inline Error Handling

Resuming a Procedure After an Error