version 6.0
DR ON ERROR (method)
| Parameter | Type | Description | |
| method | Text | Method to execute |
Description
The command DR ON ERROR installs method to manage 4D Draw errors.
If method is an empty string, no method is called and error handling returns to 4D Draw. After installation, 4D Draw calls method when a 4D Draw error occurs.
When 4D Draw calls method, it returns three parameters ($1, $2, and $3) that can be used to manage the error:
$1 is a long integer that represents the 4D Draw area where the error took place. If the error is not specific to a 4D Draw area, $1 equals 0.
$2 is an integer that holds error number.
$3 is of type text and contains the text of the error.
$2 and $3 are the equivalent to a call to DR Error.
You should declare the types of these parameters if you plan to compile your database, as follows:
C_LONGINT ($1;$2) C_TEXT ($3)
Example
This example shows the installation of an error-handling method:
DR ON ERROR ("DRAW ERROR")
The following method is DRAW ERROR, which tests $1 to determine whether the error occurred in Area and then presents an alert with the error number and message:
C_LONGINT ($1;$2)
C_TEXT ($3)
If ($1 = Area)
ALERT ("An error occurred in the 4D Draw area 'Area'")
End if
ALERT ("Error number " + String($2) + Char(13) + $3)
See Also