Internet Technologies:waa

User-defined error messages Professional

The HTML3 class has three methods used to return informational messages to a Web browser when an error condition occurs while the WAA and/or a package DLL is accessed. The methods are called by the WAA server in these situations:

:cgiError()

An invalid CGI string is submitted from the Web browser to the WAA. The WAA is unable to detect which package DLL to access and/or which form function to invoke (WAA_PACKAGE and/or WAA_FORM is not defined in a HTML page).

:dllError()

The package DLL specified with WAA_PACKAGE is not loaded or the function specified with WAA_FORM does not exist in the DLL.

:prgError()

A runtime error occurred in the package DLL (PRG code level).

The first two methods return standard HTML pages to the Web browser. The method :prgError() does not return a HTML page. Instead, it creates HTML code and must return it to the WAA server which forwards it on to the Web browser. The :prgError() method uses a HTML template file and fills it with information about the error condition. The default template is the WAA1ERR.HTM file located in the directory where WAA1SRV.EXE is found. This HTML file may be edited to display the error text in another language than English, for example. It also contains two <META> tags that control how the error is reported:

<meta error_in_new_window="false"> 

By default, the error message is displayed in the current browser window. If this meta tag is set to "true", a new browser window is opened for the error message. This, however, requires a JavaScript enabled browser.

<meta admin_email_address=""> 

This meta tag allows for adding the e-mail address of the Web administrator responsible for Web applications. If specified, the WAA server additionally sends an e-mail containing error information to this address.

Information about a runtime error is inserted into the WAA1ERR.HTM file before it is returned to the client. The file is scanned for placeholders identifying error condition details and/or HTML variables. The placeholders are then replaced with the corresponding information or the contents of HTML variables. The placeholders must appear in the HTML file between the characters <% and %>. For example:

Package <%var=WAA_PACKAGE%> has failed to 
fulfill the request of form <%var=WAA_FORM%>. 

In this text, the name of the package DLL and the form-function causing the error is inserted by the HTML3 object, since both are available as HTML variables. In addition to HTML variables, the HTML3 class uses pre-defined place holders that correspond with instance variables of an Error object:

Placeholder in HTML file      is replaced with 
-------------------------     ------------------ 
<%var=ERROR_DESCRIPTION%>     oError:description 
<%var=ERROR_OPERATION%>       oError:operation 
<%var=ERROR_GENCODE%>         oError:genCode 
<%var=ERROR_OSCODE%>          oError:osCode 

<%var=CALLSTACK%>             Callstack when error occurred 

the place holders and names of HTML variables are case sensitive!

Individual error messages

Different error messages can be sent for different package DLLs by defining the HTML file containing the error message in the HTML variable WAA_ERROR. For example:

<INPUT TYPE=hidden NAME="WAA_PACKAGE" VALUE="MyDll"> 
<INPUT TYPE=hidden NAME="WAA_FORM"    VALUE="MyFunc"> 
<INPUT TYPE=hidden NAME="WAA_ERROR" VALUE="MyError.html">

When a HTML file is specified in this way, the HTML3 object searches this file in the directory of the package DLL, loads it instead of the default error message file and returns it to the client. This way, error messages can be defined individually for a single form-function.

Another possibility of producing user-defined error messages is to create a user-defined class from the HTML3 class and overload the methods :cgiError(), :dllError() and :prgError().

Feedback

If you see anything in the documentation that is not correct, does not match your experience with the particular feature or requires further clarification, please use this form to report a documentation issue.