ServiceResponse¶
ServiceResponse is the categorized message envelope returned by service-style managers built on clsServiceAppManagerBase. It starts optimistic (Result = True) and accumulates ServiceMessage entries by category, so a caller can distinguish business validation failures from infrastructure failures without inspecting exception details itself (BR-APP-009).
Purpose¶
- Accumulates messages of four categories (
Error,Warning,Information,Environment) in a single ordered collection, exposing filtered views for each. - Converts a caught
Exception(and its inner-exception chain) intoEnvironment-category messages viaProcessException, so infrastructure failures are reported consistently with business messages. - Leaves the overall
Resultflag under caller control — this type never sets it toFalseitself, even when error messages are present (BR-APP-009).
Context¶
- Namespace:
SAIF.Application - Assembly/package:
SAIF.Application(embedded, ProjectReference)
Public members¶
| Member | Signature | Purpose |
|---|---|---|
Result |
Public Boolean field, default True |
Overall success flag; the caller must explicitly set it to False on failure (BR-APP-009). |
RequestID |
Public String field, default String.Empty |
Caller-supplied correlation id echoed back with the response. |
Messages |
Public ReadOnly Property As IEnumerable(Of ServiceMessage) |
All accumulated messages in insertion order, across all categories. |
Errors |
Public ReadOnly Property As IEnumerable(Of ServiceMessage) |
Messages filtered to ServiceMessageType.Error — business validation failures. |
Warnings |
Public ReadOnly Property As IEnumerable(Of ServiceMessage) |
Messages filtered to ServiceMessageType.Warning. |
InformationalMessages |
Public ReadOnly Property As IEnumerable(Of ServiceMessage) |
Messages filtered to ServiceMessageType.Information. |
EnvironmentalErrors |
Public ReadOnly Property As IEnumerable(Of ServiceMessage) |
Messages filtered to ServiceMessageType.Environment — infrastructure/exception-derived failures. |
ProcessException |
Public Sub (ex As Exception) |
Converts an exception and its inner-exception chain into Environment-category messages keyed by each exception's type name (BR-APP-009). |
AddErrorMessage |
Public Sub (inMessage As String, Optional inKey As String = "") |
Appends a business validation failure to Messages as an Error-category ServiceMessage. |
AddWarningMessage |
Public Sub (inMessage As String, Optional inKey As String = "") |
Appends a Warning-category ServiceMessage. |
AddInformationMessage |
Public Sub (inMessage As String, Optional inKey As String = "") |
Appends an Information-category ServiceMessage. |
AddEnvironmentMessage |
Public Sub (inMessage As String, Optional inKey As String = "") |
Appends an Environment-category ServiceMessage, the same category ProcessException uses. |
Behavioral notes¶
ProcessExceptionwalks the inner-exception chain, but a defect re-assigns the loop variable toex.InnerException(the outer exception) instead of the currentLocalEX.InnerException; any exception with a non-Nothinginner exception causes an infinite loop that appends the same message repeatedly.**Resultis never modified by this class — it remainsTrueunless the caller explicitly sets it toFalse, even afterAddErrorMessageorProcessExceptioncalls (BR-APP-009).
Constraints and usage notes¶
- Callers must inspect
Errors/EnvironmentalErrorsthemselves and setResult = Falseaccordingly; this type does not deriveResultautomatically from message content. - Given the
ProcessExceptioninfinite-loop defect, callers passing exceptions with a populatedInnerExceptionchain should verify behavior before relying on this method in production paths.**
Note: Statements marked with
*were inferred from code structure, naming conventions, or contextual evidence where direct confirmation was not available in source artifacts. Statements marked with**could not be confirmed; treat as unknown until verified.
Sources¶
SAIF.Application/Service Based/ServiceResponse.vbSAIF.Application/Service Based/ServiceMessage.vb