- Automatic management of errors
- Implementing the automatic management of errors
- Running the error process ("CASE ERROR" in the code)
- Running a procedure for processing the error:
- Displaying the error and exiting from the application:
- Display error and resume input in the current window
- Displaying the error and giving the decision to the user:
- Returning the XXX value and displaying the error
- Customizing the windows for automatic management of errors
- Functions for automatic management of errors
Automatic management of errors
The management of errors can be customized by process.
No more "IF ... NOT", "IF ErrorOccurred ..." and other nested tests that made the code difficult to understand.
You can choose to use automated error processing or advanced management via the different WLanguage functions.
Important: The automatic management of errors and exceptions operates for the process for which it was defined.
Automatic management of errors
Running a procedure for processing the error:
If this option is selected, the specified procedure will be automatically run to process the error when an error occurs in the current process. This option is recommended if a procedure used to process the errors is already found in your application. This procedure will be automatically called when an error occurs. No test to run.
This procedure can return one of the constants found in the table below.
Depending on the constant returned, WINDEV, WEBDEV or WINDEV Mobile will perform the corresponding process.
|opRetry||The function that triggered the error is re-run.|
This constant is not available in Java.
|opCancel||The function that triggered the error returns an error and the code continues to run.|
|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 <Function> THEN EndProgram()
|opRelaunchProgram||Ends the application and automatically restarts the application.
This constant is not available.
Displaying the error and giving the decision to the user:
If this option is selected, the following window will be automatically displayed if an error occurs in the application:
Down this window, the user can:
- Copy the error details into the clipboard (to transmit these details to the application provider for example)
- Stop the application
- Cancel the operation: the current process is canceled. The current window of the application is displayed.
- Retry the operation: the operation that triggered the error will be canceled then re-run.
- Automatically restart the application once it has been stopped. This option is not available in Java.
: if the "Feedback" component is included in the application (directly or via the "?" menu), the error report can be sent to the application provider.
This option and "Display the error and resume the input in the current window" have the same operating mode.
Customizing the windows for automatic management of errors
By default, the windows for managing the errors, the exceptions and the assertions are included in the application. These windows are available in English and in French.
To customize these windows (or to translate them), all you have to do is import the corresponding windows into your project:
- On the "Project" pane, in the "Project" group, expand "Import" and select "WINDEV elements and their dependencies"
- On the "Project" pane, in the "Project" group, expand "Import" and select "WINDEV Mobile elements and their dependencies"
- Select the directory of the elements to import: "Programs\Data\Preset windows\Assertion - Error - Exception".
- Select the windows to import:
|WINDEV||WINDEV Mobile||Type of window|
|WD_DisplayAssert.wdw||WM_DisplayAssert.WPW||Window for managing the assertions|
|WD_DisplayError.wdw||WM_DisplayError.WPW||Window for managing the errors|
|WD_DisplayException.wdw||WM_DisplayException.WPW||Windows for managing the exceptions|
|WD_ErrorTemplate.wdt||Template used by the WINDEV windows.|
- Validate. The windows are included in your project. These windows will be automatically used and they will replace the default windows.
Remark: To use the default windows, all you have to do is delete the imported windows from your project.
Functions for automatic management of errors
The functions for automatic management of errors are as follows:
Training (WINDEV): WD Auto Error Management
Training (WINDEV): WD Managing the Java errors
This page is also available for…
Click [Add] to post a comment