Ask Reuben

When Things Go Wrong – gui.programStoppedMessage

How can I not display the filename, line number, and error number in the error dialog?

In Ask-Reuben 14, 15, 16 I did a three part series on what you can do within your Genero application to handle errors gracefully and professionally and also to have as much information on hand as possible to allow you to investigate the issue.  At the risk of doing a Hitchhikers Guide to the Galaxy and writing “a trilogy in four parts”, there is another section I will add and that relates to the scenario where if you don’t add any specific exception handling to your code, or the error is so bad that it is not safe for the program to execute your exception handling code.  In those scenarios what should be the user experience be?  There have been two recent enhancements.

In FGL 3.10.11, as part of FGL-4216, a program stop error message box would be shown when a program ends unexpectedly.  This meant that instead of the program just stopping and no visible clue being offered to the GUI user, a dialog box would appear displaying what would otherwise have been written to the errorlog and what would be output to stdout/stderr that a TUI user would see.  That is a dialog box would appear with text like …

Program stopped at filename, line number
Error Number
Error Description

This enhancement also had the added benefit of being able to display error messages relating to user license count being exceeded.  Previously these error messages could not be displayed as to do so would mean consuming a license.  As this dialog box was instructed not to consume a license, as a result of this enhancement, it was now possible for some GUI feedback to the end-user if the reason a program did not start was due to insufficient licenses.

The concern with this dialog box was the display of details such as filename, and line number to the end-user.  An enhancement FGL-5449 was added in 3.20.11 that allows you to specify the text for a generic error message to display in this scenario.  This is implemented via a new FGLPROFILE entry gui.programStoppedMessage.  Simply define some text here and if the program stop error message box appears, this defined text will display instead of the default “Program stopped at …” text.

For example the following entry in an fglprofile file…

gui.programStoppedMessage= "A fatal error has occurred.\nPlease contact the IT help-desk"

… results in the following dialog …

… which maybe preferable to you over the default dialog that will be something like …

… as it does not put information such as filename, line number out there for an end-user to see.

Even if you have used WHENEVER ANY ERROR CALL throughout your code base and have your own dedicated error handling routine and dialog, you should still review this new FGLPROFILE parameter because there are runtime errors where it is not possible to pass through this exception handling and the program stop error message box will be displayed.  In these circumstances you might want a generic error message that is more in fitting with the rest of your application error handling.