Skip to content

Central error handling

The terminal error-handling operation for every SAIF WebForms screen: it logs the error with model/context detail, e-mails the support distribution list, and redirects the browser to an environment-appropriate error page with a sanitized message.

Field Value
Operation ID OP-MVC-11
Trigger Delegated from Page error processing, or called directly
Inputs Exception, model, context
Outputs Logged/e-mailed error; redirect to the error page with an encoded message
Primary components clsControllerBase.HandleErrors
Entry point SAIF.Presentation.Web.MVC/clsControllerBase.vb

Steps

  1. Read the support distribution list from EnvironmentService.GetConfigSetting("policymanagement.supportemaillist") (BR-MVC-024).
  2. If the setting is missing: the value is passed through as-is with no guard, which can turn a handled error into a secondary failure inside the error handler.*
  3. Call clsLogError.CreateErrorWithEmail(smTo, ex, model, context) — logs the error and e-mails support with model/context detail (BR-MVC-024).
  4. Resolve the error page from AppSettings("ErrorPageName") (BR-MVC-025).
  5. If absent: choose http://saifonline/weberror/processerror.aspx for internal callers (10.*.*.*) or https://saifonline.saif.com/weberror/processerror.aspx otherwise.
  6. HTML-encode the exception message and strip CR/LF characters (BR-MVC-026).
  7. Redirect to <errpage>?MSG=<message>&Return=<current local path> (BR-MVC-012).
  8. On failure: ThreadAbortException is caught (with ResetAbort) and Response.End() runs in Finally.

Process flow

The following diagram visualizes this operation's control flow.

flowchart TD
    Start([HandleErrors]) --> S1[Read support e-mail list setting]
    S1 --> S2[CreateErrorWithEmail: log + notify support]
    S2 --> D1{ErrorPageName configured?}
    D1 -->|Yes| S3[Use configured error page]
    D1 -->|No, internal caller| S4[Use intranet error page]
    D1 -->|No, external caller| S5[Use public HTTPS error page]
    S3 --> S6[HTML-encode message, strip CR/LF]
    S4 --> S6
    S5 --> S6
    S6 --> EndOk([Redirect to error page with MSG + Return])

Failure and edge-case behavior

  • A missing support e-mail list setting is passed straight to clsLogError.CreateErrorWithEmail with no null guard, risking a secondary failure inside the error handler.*
  • Redirect-induced ThreadAbortExceptions are suppressed the same way as elsewhere in the framework so the redirect itself never surfaces as a second error.

Note: Statements marked with * were inferred from code structure, naming conventions, or contextual evidence where direct confirmation was not available in source artifacts.

Sources

  • SAIF.Presentation.Web.MVC/clsControllerBase.vb