OnError

ATEasy provides you with the OnError() event, a default method of handling recoverable run-time errors. If there is no Try... Catch block surrounding the code, ATEasy will try to call the OnError() event in the module that causes the error.

The OnError() event contains code to recover from a recoverable run-time error. The code can display a message or do something to correct the problem. You can determine in the code the module in which the error occurred using the internal library function, GetErrorModule(). You can also determine the error code number using the internal library function, GetErrorNum(). You can take the appropriate action by addressing your error recovery code to the error and module involved.

Procedure OnError(): Void Public {

Select GetErrorNum()

CASE 243

! Do something to fix error 243

CASE 267

! Do something to fix error 267

CASE 271

RetryCounter++

If RetryCounter > 3 then

Abort

Endif

Retry

EndSelect

}

You can exit the OnError() event in the following ways:

If there is no code for the OnError() event in the module that produced the error, ATEasy has a way of looking for an error handler in other modules. For example, if there is no OnError() code in the Driver, ATEasy will look upward to the System containing the Driver, and then to the Program containing the System. So, if the error-producing module does not handle its own error, other modules can handle the error. This is important because many Driver authors will not put in any error-handling code in their Drivers, and so it is up to the System to decide what to do with these Driver errors.