Help / WLanguage / WLanguage functions / Standard functions / Debug functions
  • Overview
  • The assertions
  • Implementation
  • Tip
  • Customizing the window of assertions
WindowsLinuxUniversal Windows 10 AppJavaReports and QueriesUser code (UMC)
WindowsLinuxPHPWEBDEV - Browser code
AndroidAndroid Widget iPhone/iPadIOS WidgetApple WatchMac CatalystUniversal Windows 10 App
Stored procedures
WINDEV, WEBDEV and WINDEV Mobile include several tools and features used to optimize the applications and the sites.
The main available features are as follows:
The assertions
An assertion is used to check a condition when running the application.
If the condition fails, a dialog box containing the check details is displayed.
The developer can access the runtime stack, which means all calls that resulted in this result.
To define an assertion, simply use dbgAssert with the following parameters:
  • the condition to check,
  • the message to display if the condition is not checked.
// CClient variable
clClient is CClient
// Create the client
// The clClient object must have been instantiated
dbgAssert(clClient<>Null, "The object was not instantiated")
By default, the assertions are enabled in test mode only.
The assertions can be enabled in deployment: simply use dbgEnableAssert:

Caution: The condition used in the assertion is run by WLanguage only when the assertions are enabled. Therefore, the operating mode may differ in test mode and in executable mode.
You must be very careful when using functions in the condition given to dbgAssert. Indeed, if the function used performs an initialization or a connection, this operation will not be performed in the application used in "executable" mode.
On the other hand, this operating mode allows you to run "more tests" without slowing down the deployed application. This gives you the ability to easily enhance the applications.


Assertions can be used to run "specific" cases or to check the "prerequisites" of a function. This allows you to check the case that should never happen:
  • using an empty string while a logical name is expected,
  • entering a path to a file that does not exist, ...
The assertions cannot replace the standard management of errors. But implementing an assertion allows you to be informed and to find out whether a problem occurred via the execution stack.
The assertions are also used to guide you when the development is performed by several developers: the "calling" code must provoke no assertion in the code that is "called".

Customizing the window of assertions

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.
  1. In the ribbon:
    • WINDEV On the "Project" tab, in the "Project" group, expand "Import" and select "WINDEV elements and their dependencies".
    • WINDEV Mobile On the "Project" tab, in the "Project" group, expand "Import" and select "WINDEV Mobile elements and their dependencies".
  2. Select the directory of the elements to import: "Programs\Data\Preset windows\Assertion - Error - Exception".
  3. Select the windows to import:
    WINDEVWINDEV MobileType of window
    WD_DisplayAssert.wdwWM_DisplayAssert.WPWWindow for managing the assertions
    WD_DisplayError.wdwWM_DisplayError.WPWWindow for managing the errors
    WD_DisplayException.wdwWM_DisplayException.WPWWindows for managing the exceptions
    WD_ErrorTemplate.wdtTemplate used by the WINDEV windows.
  4. 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.
Minimum version required
  • Version 11
This page is also available for…
Click [Add] to post a comment

Last update: 07/03/2023

Send a report | Local help