- Operating mode of custom errors
- Using a class method to customize the errors
- Customizing the default error windows
- Customizing the default error pages
HOnError (Function) In french: HSurErreur
Not available with this kind of connection
Syntax
<Result> = HOnError(<Data file> , <Type of error> [, <Procedure/window/page>])
<Result>: Boolean - True if the operation was successfully performed,
- False otherwise. HError returns more details about the problem.
<Data file>: Character string (with or without quotes) Name of data file used. If this parameter is equal to "*" the customization will be applied to all data files found in the analysis or defined by programming. <Type of error>: Constant or combination of constants Type of error to configure. | | hErrDatabaseAccess | Configures the access errors to an HFSQL Client/Server database (access forbidden by HNoDatabaseAccess).
| hErrLock | Configure lock errors.
| hErrDuplicates | Configure duplicate errors.
| hErrIntegrity | Configure integrity errors.
| hErrModify | Configure a modification conflict.
| hErrPassword | Configure password errors (wrong password).
| hErrConnectionLoss | Configure the errors caused by a loss of connection with the HFSQL server.
| hErrIndex | Configures indexing errors (reindexing in progress during the file access).
| hErrNeedValue | Configure errors caused by a mandatory input with no data (OLE DB and some native accesses).
| hErrAll | Configure all previous errors (except hErrIndex).
|
<Procedure/window/page>: Optional character string Corresponds to:  Name of window or procedure to call when a <Type of error> error occurs. Name of page or procedure to call when a <Type of error> error occurs. - Name of object method if HOnError is called in a method of this object.
Versions 20 and later  Name of procedure to call when a <Type of error> error occurs. New in version 20  Name of procedure to call when a <Type of error> error occurs.   Name of procedure to call when a <Type of error> error occurs. - Parameter not specified. If "Enable the automatic HFSQL help" is checked in the project, the default window or page for automatic management of errors is used for the specified type of error and for the specified data file.
- Empty string. In this case, the automatic management of errors will be disabled.
Remark: To disable the automatic management of errors, you also have the ability to uncheck "Enable the automatic HFSQL help" in the project.
Remark: In some cases (loss of connection errors for example), the procedure/window/page will be run during the next call to the WLanguage function following the event that triggered the error.
Special case: using a window, a page or a procedure found in a component: The following syntax must be used: Procedure:
HOnError(<Data file>, <Type>, ... "<Component>.<Name of set of procedures>.<Procedure name>")
Window:
HOnError(<Data file>, <Type>, "<Component>.<Window name>")
Page:
HOnError(<Data file>, <Type>, "<Component>.<Page name>")
Remarks Operating mode of custom errors The procedure, window or page used to customize the error must return one of the following constants: | | opRetry | The function that triggered the error is re-run. | opCancel | The function that triggered the error returns an error as if the assisted management was disabled. Remark: For the errors of loss of connection, the error is fatal. | opEndProcess | The function that triggered the error returns an error and the current process stops. Equivalent to the following code line:
IF NOT <HFSQL function> THEN ReturnToCapture()
| opEndProgram | The function that triggered the error returns an error and the program stops. Equivalent to the following code line:
IF NOT <HFSQL function> THEN EndProgram()
| opRelaunchProgram | The program stops and the application is automatically restarted.
|
Using a class method to customize the errors <Name of procedure or window> can also correspond to a method of an object if HOnError is called in a method of this object. All you have to do is specify the name of the method to use (without using the object name as prefix). When the method is called by the HFSQL engine, a fatal error occurs if the object used during the call to HOnError is no longer created.
Related Examples:
|
Training (WINDEV): WD Managing HFSQL Errors
[ + ] The "WD Managing HFSQL Errors" example presents the management of HFSQL errors (duplicate, integrity). This example explains how to customize the process when an error occurs.
|
This page is also available for…
|
|
|