To handle errors in the Error event of the Connection object, you create a user object that customizes the definition of the object. Once you have created the custom Connection object, you can refer to it anywhere in your scripts where you use a Connection object. If you use the JaguarORB event, you can script its Error event in the same way.
The Connection Object wizard creates a custom Connection object for you. See “Using the wizard to create a Connection object”.
The Error event of the custom Connection object has several arguments that provide information about the condition that caused the error. For example, these arguments provide the error number and error text, as well as the name of the object that caused the error and the full text of the script where the error occurred.
In addition to the arguments that provide error information, the Error event has an argument that lets you specify what action to take. To specify the action, you assign one of four enumerated values (ExceptionFail!, ExceptionRetry!, ExceptionIgnore!, or ExceptionSubstituteReturnValue!) to the Action argument of the Error event.
In this example, the Error event script informs the user of the condition that caused the communications error and gives the user the opportunity to control what happens next. Depending on the user’s input, the client application fails, retries the operation, or ignores the error and continues processing:
int li_choice li_choice = MessageBox("Connection error " + & string(ErrorNumber), ErrorText, & Question!,AbortRetryIgnore!)
CHOOSE CASE li_choice CASE 1 Action = ExceptionFail! CASE 2 Action = ExceptionRetry! CASE 3 Action = ExceptionIgnore! END CHOOSE