Skip to content

Build an application exception detail

Builds a SAIF.Core.Contracts.ApplicationExceptionDetail diagnostic record carrying environment, machine, user, and formatted exception context for a caught exception, to be logged by the caller.

Field Value
Operation ID OP-SFC-014
Trigger Called by Merge document ranges into one PDF step 5 and four call sites in PdfAPI\Services\
Inputs IEnvironmentService, caller page label (string), message (string), Exception
Outputs ApplicationExceptionDetail
Primary components PdfHelper.GetApplicationDetail
Entry point PdfApi.SyncFusionCore\PdfHelper.cs

Steps

  1. Construct SAIF.Core.Contracts.ApplicationExceptionDetail with Application = "PdfApi" (hard-coded) (BR-SFC-037).
  2. Set Environment from envSvc.GetApplicationTrack() — IEnvironmentService is a caller-injected dependency from SAIF.Framework.Core — Machine from Environment.MachineName, User from Environment.UserName, and ExceptionDate from DateTime.Now (BR-SFC-038).
  3. Set Page to the supplied caller label, Message to the supplied message, and State to ex.GetFullFormattedException() (SAIF.Common.Extensions).

Process flow

The following diagram visualizes this operation's control flow.

flowchart TD
    Start(["GetApplicationDetail called<br>with envSvc, page, message, ex"]) --> Construct["Construct<br>ApplicationExceptionDetail,<br>Application = PdfApi"]
    Construct --> Context["Set Environment, Machine,<br>User, ExceptionDate"]
    Context --> State["Set Page, Message,<br>State = formatted exception"]
    State --> Return([Return ApplicationExceptionDetail])

Failure and edge-case behavior

  • This operation performs no I/O of its own beyond reading environment/process values; it does not log or throw. The caller is responsible for passing the constructed detail to ILogService.

Sources

  • PdfApi.SyncFusionCore\PdfHelper.cs