ServiceResponse¶
ServiceResponse aggregates ServiceMessage entries produced during a service-style operation into a single result contract, with type-filtered accessors for errors, warnings, informational messages, and environment errors. It also converts unhandled exceptions into environment-type messages via ProcessException.
Purpose¶
- Provide a service-oriented result contract (success flag, request ID, and a categorized message collection) distinct from
AppManagerBase's UI-message-string approach (Build a service-style result). - Convert an unhandled exception (and its inner exceptions) into
ServiceMessageentries viaProcessException.
Context¶
- Namespace:
SAIF.Application - Assembly/package:
SAIF.Application(embedded library, inService Based\)
Public members¶
| Member | Signature | Purpose |
|---|---|---|
Result |
Public Result As Boolean |
Public field indicating overall success (True by default); callers typically set this to False on failure. |
RequestID |
Public RequestID As String |
Public field carrying a caller-assigned request correlation identifier. |
Messages |
Public ReadOnly Property Messages As IEnumerable(Of ServiceMessage) |
Exposes the full, unfiltered collection of accumulated messages. |
Errors |
Public ReadOnly Property Errors As IEnumerable(Of ServiceMessage) |
Filters Messages to only ServiceMessageType.Error entries. |
Warnings |
Public ReadOnly Property Warnings As IEnumerable(Of ServiceMessage) |
Filters Messages to only ServiceMessageType.Warning entries. |
EnvironmentalErrors |
Public ReadOnly Property EnvironmentalErrors As IEnumerable(Of ServiceMessage) |
Filters Messages to only ServiceMessageType.Environment entries. |
InformationalMessages |
Public ReadOnly Property InformationalMessages As IEnumerable(Of ServiceMessage) |
Filters Messages to only ServiceMessageType.Information entries. |
ProcessException |
Public Sub ProcessException(ex As Exception) |
Records the exception's message/type as an Environment-type ServiceMessage, then loops over inner exceptions to record each in turn. |
AddErrorMessage |
Public Sub AddErrorMessage(inKey As String, inMessage As String) |
Appends a new Error-type ServiceMessage to the internal list. |
AddWarningMessage |
Public Sub AddWarningMessage(inKey As String, inMessage As String) |
Appends a new Warning-type ServiceMessage to the internal list. |
AddInformationMessage |
Public Sub AddInformationMessage(inKey As String, inMessage As String) |
Appends a new Information-type ServiceMessage to the internal list. |
AddEnvironmentMessage |
Public Sub AddEnvironmentMessage(inKey As String, inMessage As String) |
Appends a new Environment-type ServiceMessage to the internal list. |
Behavioral notes¶
ProcessExceptionloopsDo While LocalEX IsNot Nothingbut re-readsex.InnerException(not the current local exception) on each iteration, which would infinite-loop ifex.InnerExceptionis non-Nothing; it could not be confirmed whether this path has ever executed against a real multi-level exception chain at runtime.**
Constraints and usage notes¶
- Callers should be aware of the potential infinite loop in
ProcessExceptionwhen handling exceptions with a populatedInnerExceptionchain.**
Note: Statements marked with ** could not be confirmed; treat as unknown until verified.
Sources¶
SAIF.Application\Service Based\ServiceResponse.vb