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.
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):
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):
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."