Configuration‎ > ‎

Error Handling in QBO 2.0

posted Dec 29, 2011, 6:37 AM by Eric Patrick
QBO 2.0 ASPX pages all derive from a custom qbo.Web.Page class. This page include wrapping any untrapped errors in a qbo.Error.Exception, which is logged to an error folder in accordance with configuration settings.

The following components enable customization of error behavior.

qbo.ErrorFolder App Setting

This app setting will determine what folder error messages are logged to. The qbo.Error classes will create a new folder for each day, and log error messages as xml files to this folder. Note that the Windows account under which IIS is operating (typically Network Service) must have full control of this folder to successfully write error messages.

Sample setting (from /Config/AppSettings.config):

<!-- qbo.ErrorFolder:
Physical path to stored error logs in.  This folder must be manually created.
The default error handler do not attempt to create this folder dynamically.
Setup Note: Ensure the web account (typically Network Service or IIS_IUSRS) has full control of this path.
-->
<add key="qbo.ErrorFolder" value="c:\program files\Quandis\Quandis Business Objects v2.0.0\Logs\core.localhost.net\"/>

Custom Error Page

The qbo.ErrorWeb.ErrorTrap.aspx page will provide for customized error message displays to the end user. This leverages the standard ASP.NET <customErrors> functionality available in web.config.  When ASP.NET redirects to this page, the page will transform a raw XML version of the error message into a "friendly" error message for the end users.

Sample setting (from web.config):

<customErrors mode="RemoteOnly" defaultRedirect="/Error/ErrorTrap.aspx"/>

Customizing Error Messages

The ErrorTrap.aspx page will accept either a parameter called 'ID', or a cookie called 'qbo.Error.ID', representing a relative path to the error file. This error file is read into an XML document, and transformed against /Templates/Error/ErrorMessage.xslt. 

To customize error messages, modify the ErrorMessage.xslt. Examples are found in the ErrorMessage.xslt in source control. For example, if a user attempts to manually "hack" a URL to navigate to a Loan they don't have access to, the pLoanSelect stored procedure will return zero rows, but the LoanObject class expects a row to be returned. The raw error message includes, "There is no row at position 0", but we would prefer to display to the user, "You attempted to access data that no longer exists, or that you do not have permission to access."
Comments