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¶
- If
m_controllerisNothing, rethrow the original exception. - Call the overridable
HandleApplicationError(ex)hook. - If it returns
True: no further action is taken (the application handled it). - Otherwise, if the exception's runtime type name is
clsSAIFException(checked via reflection), read itsSAIFExceptionTypeproperty and branch: TimeOutException→ set a "Database Timeout" message, log viaclsLogError.CreateError, then navigate toDefault.aspxwith the encoded message appended as theMSGquery-string parameter.DatabaseNotAvailableException→ set a "Database currently unavailable" message, log, then navigate toDefault.aspxwith the encoded message appended as theMSGquery-string parameter.- Any other
clsSAIFExceptionsubtype → delegate toclsControllerBase.HandleErrors(ex)(step 5). - If the exception is not a
clsSAIFException, delegate directly toclsControllerBase.HandleErrors(ex)(step 5). clsControllerBase.HandleErrors(ex):- Sends an e-mail and logs via
clsLogError.CreateErrorWithEmail, with the recipient list resolved from thepolicymanagement.supportemaillistconfiguration key. - 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. - HTML-encodes the exception message and redirects to the resolved error page with
MSG=andReturn=query parameters, then ends the response. - On failure:
ThreadAbortExceptionfrom the redirect is swallowed viaThread.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
clsSAIFExceptiontype check is reflection-based (runtime type name comparison), not a compile-timeTypeOfcheck, sinceclsSAIFExceptionis not referenced by this library's assembly. HandleErrorsalways attempts to send an e-mail viaclsLogError.CreateErrorWithEmail, even for high-frequency errors — no throttling or deduplication exists in this library.
Related documentation¶
Sources¶
- SAIF.Presentation.Web.MVC\ViewPageBase.aspx.vb
- SAIF.Presentation.Web.MVC\clsControllerBase.vb