ONLINE HELP
 WINDEVWEBDEV AND WINDEV MOBILE

This content has been translated automatically.  Click here  to view the French version.
Help / WLanguage / Managing databases / HFSQL / HFSQL functions
  • Operating mode of custom errors
  • Using a class method to customize the errors
  • Customizing the default error windows
  • Customizing default error pages
WINDEV
WindowsLinuxJavaReports and QueriesUser code (UMC)
WEBDEV
WindowsLinuxPHPWEBDEV - Browser code
WINDEV Mobile
AndroidAndroid Widget iPhone/iPadIOS WidgetApple WatchMac Catalyst
Others
Stored procedures
Customizes the management of HFSQL errors.
WINDEV, WEBDEV and WINDEV Mobile propose an automatic management of errors. The automatic management of errors can be disabled or enabled for one or more data files, for one or more types of errors. To do so, use HOnError and specify an empty string for the name of window, page or procedure. For more details, see HFSQL error handling help.

HFSQL Client/ServerStored procedures The automatic management of errors is not available for the stored procedures.
Stored procedures HOnError can be used to manage the error in a stored procedure.
AndroidAndroid Widget Java Onlu the loss of connection can be customized.
WINDEVWEBDEV - Server codeReports and QueriesUser code (UMC)AjaxHFSQL ClassicHFSQL Client/ServerHyper File 5.5OLE DBNative Connectors (Native Accesses)
// Personnalisation des erreurs de blocages
// La procédure SurErreurBlocage est appelée 
// en cas d'erreur de blocage pour tous les fichiers de données
HOnError("*", hErrLock, "SurErreurBlocage")
WINDEVWEBDEV - Server codeReports and QueriesUser code (UMC)HFSQL ClassicHFSQL Client/ServerHyper File 5.5OLE DBNative Connectors (Native Accesses)
// Ré-activation générale de la gestion automatique
// de toutes les erreurs sur tous les fichiers de données
HOnError("*", hErrAll)
WINDEVWEBDEV - Server codeReports and QueriesUser code (UMC)AjaxHFSQL ClassicHFSQL Client/ServerHyper File 5.5OLE DBNative Connectors (Native Accesses)
// Ré-activation générale de la gestion automatique
// des erreurs de blocage sur le fichier de données Client
HOnError("Client", hErrLock)
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
Name of the data file used. If this parameter is equal to "*" the customization will be applied to all data files found in the analysis or defined programmatically.
<Type of error>: Constant or combination of constants
Type of error to configure.
hErrAllConfigure all previous errors (except hErrIndex).
AndroidAndroid Widget Java This constant is not available.
hErrConnectionLossConfigure the errors caused by a loss of connection with the HFSQL server.
hErrDatabaseAccessConfigures the access errors to an HFSQL Client/Server database (access forbidden by HNoDatabaseAccess).
AndroidAndroid Widget Java This constant is not available.
hErrDuplicatesConfigure duplicate errors.
AndroidAndroid Widget Java This constant is not available.
hErrIndexConfigures indexing errors (reindexing in progress during the file access).
AndroidAndroid Widget Java This constant is not available.
hErrIntegrityConfigure integrity errors.
AndroidAndroid Widget Java This constant is not available.
hErrLockConfigure lock errors.
AndroidAndroid Widget Java This constant is not available.
hErrModifyConfigure a modification conflict.
AndroidAndroid Widget Java This constant is not available.
hErrNeedValueConfigure errors caused by a required value that has not been specified (OLE DB and some Native Connectors).
AndroidAndroid Widget Java This constant is not available.
hErrPasswordConfigure password errors (wrong password).
AndroidAndroid Widget Java This constant is not available.
<Procedure/window/page>: Optional character string
Corresponds to:
  • WINDEV Name of window or procedure to call when a <Type of error> error occurs.
  • WEBDEV - Server code 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.
  • AndroidAndroid Widget Java 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.
    Note: To disable automatic error handling, you can also uncheck the project option "Enable HFSQL automatic assistance".
Note: In some cases (e.g. lost connection errors), the procedure/window/page will only be executed on the next call to the WLanguage function following the event causing the error.
WEBDEV - Server code Only some of the windows/pages for the automatic management of errors are available. The automatic management of errors is disabled for these errors.

Special case: using a Component window, page or Procedure 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>")
HFSQL Client/Server If a loss of connection occurs, to ask for reconnection, this procedure must call HReconnect.
Remarks

Operating mode of custom errors

The procedure, window or page used to customize the error must return one of the following constants:
opCancelThe function that triggered the error returns an error as if the assisted management was disabled.
Note For loss-of-connection errors, the error is fatal.
opEndProcessThe function that triggered the error returns an error and the current process stops. Equivalent to the following line of code:
IF NOT <HFSQL function> THEN SetFocusAndReturnToUserInput()
AndroidAndroid Widget Java This constant is not available.
opEndProgramThe function that triggered the error returns an error and the program stops. Equivalent to the following line of code:
IF NOT <HFSQL function> THEN EndProgram()
opRelaunchProgramThe program stops and the application is automatically restarted.
AndroidAndroid Widget Java This constant is not available.
opRetryThe function that triggered the error is re-run.

HFSQL Client/Server If a loss of connection occurs, to ask for reconnection, HReconnect must be used in the procedure called by HOnError.

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).
A fatal error occurs if the object used in the call to HOnError is no longer allocated when the HFSQL engine calls the method
WINDEVReports and QueriesHFSQL ClassicHFSQL Client/ServerHyper File 5.5OLE DBNative Connectors (Native Accesses)

Customizing the default error windows

The default error windows and their WLanguage code are available in the "\Programs\Data\Preset Windows\EN\HyperFileSQL - Automatic Help Windows" directory.
These windows can be customized, included in your projects, and passed as parameters to HOnError.
For more details, see HFSQL error handling help.
WEBDEV - Server codeHFSQL ClassicHFSQL Client/ServerHyper File 5.5OLE DBNative Connectors (Native Accesses)

Customizing default error pages

The default error pages and their WLanguage code are available in the "\Programs\Data\Preset Pages\EN\HyperFileSQL - Automatic Help Pages" directory.
These pages can be customized, included in your projects, and passed as parameters to HOnError.
For more details, see HFSQL error handling help.
Related Examples:
WD Managing HFSQL Errors 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.
Component: wd300hf.dll
Minimum version required
  • Version 9
This page is also available for…
Comments
Click [Add] to post a comment

Last update: 03/27/2025

Send a report | Local help