Labels
Description
Goal
Return useful diagnostic details when one or more domain-event handlers fail instead of returning a bare HTTP 500.
Proposed change
- Update
TransactionProcessor/Controllers/DomainEventController.csto retain each handler alongside its task. - Await handler execution asynchronously with
Task.WhenAll. - Aggregate all failed handler results, including the handler name and failure message.
- Capture handler exceptions as failure entries.
- Return an RFC 7807
ProblemDetailsresponse with:title:One or more event handlers failedstatus:500eventIdeventTypefailures, containinghandleranderrorfor each failure.
- Preserve the existing successful
200 OKbehavior. - Add focused controller coverage for the response shape and multiple failures.
Example response
{
"title": "One or more event handlers failed",
"status": 500,
"eventId": "fe57bd2b-3ccb-4d10-a2f7-7435237d4d19",
"eventType": "ProductDetailsAddedToTransactionEvent",
"failures": [
{
"handler": "ReadModelDomainEventHandler",
"error": "Transaction not found with Id ..."
}
]
}Acceptance criteria
- Every failed handler is represented in the response.
- Each failure identifies the handler and its error message.
- Thrown handler exceptions are captured consistently.
- No stack traces or sensitive implementation details are exposed unintentionally.
- Existing success and retry/parking behavior remains compatible.
- Relevant tests pass.
Activity