|
|
|
|
- How to get information about the error processed?
- Special case
ErrorChangeParameter (Function) In french: ErreurChangeParamètre Configures the automatic behavior that will be implemented if an error occurs in the current process. The previous behavior can be restored by ErrorRestoreParameter.
// Initializes the connection to the HFSQL Client/Server database // Returns True if everything is OK, False otherwise PROCÉDURE InitializeConnection() // If an error occurs, exit and return False ErrorChangeParameter(epResult, False) // Describe the connection HDescribeConnection("Connection", "user", "password", ... "server","database", hAccessHFClientServer) // Open the connection HOpenConnection("Connection") // OK RETURN True // Code replaced // Initializes the connection to the HFSQL Client/Server database // Returns True if everything is OK, False otherwise // PROCEDURE InitializeConnection() // Describe the connection // IF HDescribeConnection("Connection", "user", "password", ... // "server", "database", hAccessHFClientServer) = False THEN // RESULT False // END // Open the connection // IF HOpenConnection("Connection") = False THEN // RESULT False // END // OK // RESULT True
Syntax
ErrorChangeParameter(<Behavior to implement> [, <Parameter 1> [, <Parameter 2>]])
<Behavior to implement>: Integer constant Behavior to implement: | | epCode | Current mode: the error is processed through programming (test the return value of the functions, using ErrorOccurred, ...) | epDisplayMessage | Displays the error message in a window that proposes the following choices: Retry, Cancel and Stop. | epDisplayMessageEndProcess | Displays the error message in a window that proposes the following choices: Cancel and Stop. | epDisplayMessageEndProgram | Displays the error message in a window that proposes the following choices: Stop and Restart (Stop by default). | epDisplayMessageRelaunchProgram | Displays the error message in a window that proposes the following choices: Stop and Restart (Restart by default). | epExecuteProcedure | Runs the procedure specified as parameter. This procedure must return one of the following constants:- opCancel: the function triggers an error in the code used to call the procedure.
- opEndProcess: the error is validated and the user takes control
- opEndProgram (by default): the application is stopped.
- opRetry: retries the statement
- opRelaunchProgram: stops and restarts the application.
| epGotoCaseError | Runs the code defined by: CASE ERROR: | epResult | Validates the errors. Exits from the current process and returns the specified value (<Parameter 1> contains the value to return). | epResultError | Validates the errors. Exits from the current process, returns the specified value (<Parameter 1> contains the value to return) and propagates the error.The error is automatically processed by the higher level (if the error process is enabled), or by IF NOT xxx or IF ErrorOccurred. <Parameter 2> contains n additional error messages. | epReturn | Validates the errors. Exits from the current process. The error is not propagated if the automatic management of errors is enabled in the calling code. | epReturnError | Validates the errors. Exits from the current process and propagates the error.The error is automatically processed by the higher level (if the error process is enabled), or by IF NOT xxx or IF ErrorOccurred. The error is propagated if the automatic management of errors is enabled in the calling code. | These constants can be combined with the epDisplayMessage constant: in this case, the error message will be displayed before running the specified behavior. <Parameter 1>: Optional parameter Optional parameter depending on the selected behavior. <Parameter 2>: Optional parameter Optional parameter depending on the selected behavior. Remarks How to get information about the error processed? ErrorInfo returns information about the error. The error handling mechanism, whether it is managed automatically (via the error handling window) or programmatically (with ErrorChangeParameter), is not triggered if the WLanguage function or the user procedure is in one of the following cases:
IF NOT <Function or procedure> THEN // process the error END
<Function or procedure> IF ErrorOccurred = True THEN // process the error END
The mechanism considers that the error is processed by programming and the automatic process is not triggered. Business / UI classification: Neutral code
This page is also available for…
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|