What's New in Uniface 10.4.02
Rocket® Uniface 10.4.02 introduces the ability to throw and catch exceptions to handle ProcScript and user-defined errors. It also opens up the USYSHTTP component so that you can customize its behavior when processing web requests from the Web Request Dispatcher (WRD).
Uniface 10.4.02 also consolidates features, bug fixes, and updates made in patches since the release of 10.4.01.
Exception handling is a significant enhancement to the Uniface scripting language that makes it easier for you to create maintainable, robust, and readable code. It removes the need for inline error checking on each statement and enables you to encapsulate the error handling into centralized routines.
Currently, when a ProcScript statement or function causes a runtime error, Uniface sets $procerror and $procerorcontext. Typically, you need to add ProcScript after the instruction to check for errors and deal with them. If this does not happen, errors are ignored and code execution continues.
When exception handling is enabled, a ProcScript statement or function that results in a runtime error causes Uniface to stop code execution and throw an exception that contains the ProcScript error. A thrown exception needs to be caught to deal with the error. If it is not caught, Uniface exits with an uncaught exception.
Exceptions provide a fail fast mechanism that makes it easier for you to find programming mistakes and to identify configuration errors and environment failures. It ensures that applications in a non-controlled state do not continue running, with the risk of unnoticed data corruption and security vulnerabilities.
You can enable exceptions on a per module basis using the throws declaration, or using
try-catch blocks. This enables you to take advantage of the new exception handling feature without interfering with existing code. You can also throw custom exceptions using the throw and throw/list commands.
In this release, the new exception handling feature includes:
- New ProcScript commands to control and implement exception handling:
- throws—declares that any runtime error ($procerror) that occurs in the module will be regarded as an exception. For more information, see throws.
- try-endtry—block declaration that specifies the code that can throw an exception. For more information, see try.
- catch—specifies code within the try block that will handle any resulting exceptions. For more information, see catch.
- throw, throw/list— throw a custom exception value. For more information, see
throw and throw/list.
- $procerrorcontext has been enhanced to include the call stack when a module throws an exception, and the return value for selected web request triggers. The call stack describes the stack of commands that were executed until the command that caused the exception, allowing you to quickly trace which module and instructions caused the exception. For more information, see
$procerrorcontext and ProcScript Call Stack.
- For the preActivate trigger, $procerrorcontext has been enhanced to indicate whether the exception was caused by a negative return value or an actual exception. For more information, see trigger preActivate.
- Default reporting on uncaught exceptions—when an uncaught exception occurs, Uniface reports the exception details( $procerrorcontext) in a readable format so that you can quickly see what is wrong and fix the problem.
For interactive GUI and CHUI applications, the information is displayed in a dialog, else exception details are written to the log file. This dialog can be suppressed using the $SUPPRESS_UNCAUGHT_EXCEPTION_DIALOG assignment setting. For more information, see $SUPPRESS_UNCAUGHT_EXCEPTION_DIALOG.
In the Web Application Server, Uniface now includes exceptions as part of the response to the web request. You can customize this reporting with the USYSHTTP component.
- Updated templates which are exception-enabled by default.
When creating new objects, all triggers and operations include the throws statement, enabling exceptions for new development. These templates are delivered in the utemplates.xml file, located in the uniface\misc directory of your Uniface installation.
USYSHTTP Component API
Prior to this release, the USYSHTTP component was an internal component activated by the Web Request Dispatcher (WRD) to handle web requests. The component has been enhanced to support exceptions, as well as classic error handling.
The source code is now provided in the uniface/misc folder, enabling you to inspect the component, and customize the behavior before and after handling web requests, and create robust web request handlers.
For more information, see
USTRUCT Helper Libraries
Struct handling helper libraries are now available in the Uniface IDE to make using Structs easier. Included are:
- USTRUCT Snippet library (libsnp:USTRUCT)—included in the set of Uniface IDE templates (utemplates.xml) with examples of calling Struct functions. Select the USTRUCT Snippet library in your Resource Browser to insert and use the snippets.
- USTRUCT Global ProcScript library (libprc:USTRUCT)—available in the Uniface runtime as a library of helper functions. The source code is provided, enabling you to customize the code as required. To inspect or modify this library, import libprc.ustruct.xml from the uniface/misc folder. Development documentation is included in the code as comments. A unit test is also included to test any changes made.
Both USTRUCT libraries are exception-enabled by default.
Any feedback or suggested enhancements are welcomed so we can continue to improve these helper libraries.
For more information, see Transforming Complex Data Using Structs.
Sentinel License Manager Version 10
Sentinel version 10 has been included on Windows and Linux to support the Cloud License Manager (LM), the latest Sentinel cloud licensing system. Sentinel version 9 remains the default for all other licensing types.
For more information, see
Compile Global ProcScripts as no-debug
It is now possible to compile Global ProcScripts so that they cannot be debugged, using the $NO_DEBUG assignment setting, /nodebug command line sub-switch or $ude("compile"). For more information, see Configuring Compilation.
Literal Label Pool's maximum size increased to 4GB
The maximum capacity of the Literal Label Pool has been increased from 64KB to 4GB. The Literal Label Pool contains any literals used within the component, such as component names, field names, entity names and models. For more information, see 1064 Literal Label Pool exceeds 4GB.
Uniface regularly updates support for and use of third-party software, platforms, and database. The most current versions are usually reflected in the Platform Availability Matrix.
Uniface Server Docker Image
We now provide a Uniface Server Docker Image that allows you to run Uniface solutions in a containerized Docker environment. It contains a Linux Uniface server environment, including the Uniface Router and Uniface Server.
For more information, see Uniface Server Docker Image.
Updated C++ Compiler
Uniface has updated its C++ compiler to Microsoft Visual Studio compiler 2022, which provides improved performance, stability, and security.
When printing grayscale jpeg images with the PostScript driver, the output looks slightly different in the gray areas of the pictures. This is caused by the difference in floating point handling of the C-runtime that comes with the VS2022.
The Uniface installation includes the latest Microsoft redistributable, which is backwards compatible with VS2015.