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