Skip to content

Error handling

ViewPageBase.ProcessError intercepts any unhandled exception raised during a page's lifecycle, gives the concrete application a chance to handle it, dispatches on SAIF-specific exception types, and otherwise delegates to clsControllerBase.HandleErrors for logging, e-mail notification, and redirect to a central error page.

Field Value
Operation ID OP-MVC-005
Trigger ViewPageBase.Page_Error, calling ProcessError(ex)
Inputs The unhandled exception
Outputs User-facing message and/or redirect
Primary components ViewPageBase.ProcessError, clsControllerBase.HandleErrors
Entry point SAIF.Presentation.Web.MVC\ViewPageBase.aspx.vb

Steps

  1. If m_controller is Nothing, rethrow the original exception.
  2. Call the overridable HandleApplicationError(ex) hook.
  3. If it returns True: no further action is taken (the application handled it).
  4. Otherwise, if the exception's runtime type name is clsSAIFException (checked via reflection), read its SAIFExceptionType property and branch:
  5. TimeOutException → set a "Database Timeout" message, log via clsLogError.CreateError, then navigate to Default.aspx with the encoded message appended as the MSG query-string parameter.
  6. DatabaseNotAvailableException → set a "Database currently unavailable" message, log, then navigate to Default.aspx with the encoded message appended as the MSG query-string parameter.
  7. Any other clsSAIFException subtype → delegate to clsControllerBase.HandleErrors(ex) (step 5).
  8. If the exception is not a clsSAIFException, delegate directly to clsControllerBase.HandleErrors(ex) (step 5).
  9. clsControllerBase.HandleErrors(ex):
  10. Sends an e-mail and logs via clsLogError.CreateErrorWithEmail, with the recipient list resolved from the policymanagement.supportemaillist configuration key.
  11. Resolves an error page: AppSettings["ErrorPageName"] if configured, else a hardcoded internal (http://saifonline/weberror/processerror.aspx) or external (https://saifonline.saif.com/weberror/processerror.aspx) SAIF error URL based on the client's host address.
  12. HTML-encodes the exception message and redirects to the resolved error page with MSG= and Return= query parameters, then ends the response.
  13. On failure: ThreadAbortException from the redirect is swallowed via Thread.ResetAbort().

Process flow

flowchart TD
    Start([Page_Error]) --> NullCheck{m_controller is Nothing?}
    NullCheck -->|Yes| Rethrow([Rethrow original exception])
    NullCheck -->|No| AppHandler[HandleApplicationError hook]
    AppHandler --> Handled{Returns True?}
    Handled -->|Yes| End([No further action])
    Handled -->|No| SaifType{Is clsSAIFException?}
    SaifType -->|TimeOutException| TimeoutMsg[Log + navigate: Database Timeout]
    SaifType -->|DatabaseNotAvailableException| DbMsg[Log + navigate: Database unavailable]
    SaifType -->|Other SAIF type| HandleErrors[clsControllerBase.HandleErrors]
    SaifType -->|Not a SAIF exception| HandleErrors
    HandleErrors --> Email[Log + email via clsLogError.CreateErrorWithEmail]
    Email --> ResolvePage[Resolve error page URL]
    ResolvePage --> Redirect([Redirect with MSG and Return params])

Failure and edge-case behavior

  • If HandleApplicationError(ex) itself throws, the resulting exception is not caught by this operation — it propagates to the ASP.NET runtime's default error handling.
  • The clsSAIFException type check is reflection-based (runtime type name comparison), not a compile-time TypeOf check, since clsSAIFException is not referenced by this library's assembly.
  • HandleErrors always attempts to send an e-mail via clsLogError.CreateErrorWithEmail, even for high-frequency errors — no throttling or deduplication exists in this library.

Sources

  • SAIF.Presentation.Web.MVC\ViewPageBase.aspx.vb
  • SAIF.Presentation.Web.MVC\clsControllerBase.vb