Add ErrorAction to RecActionDto and batch error handling
Introduce ErrorAction property to RecActionDto for per-action error handling. Update InvokeRecActionsCommandHandler to check invocation results and use ErrorAction to determine whether to continue or stop on failure, enabling configurable batch processing behavior. Add ErrorAction to RecActionDto and batch error handling Introduce ErrorAction property to RecActionDto for per-action error handling. Update InvokeRecActionsCommandHandler to check invocation results and use ErrorAction to determine whether to continue or stop processing on failure. This enables configurable error handling in batch action execution.
This commit is contained in:
@@ -62,6 +62,8 @@ public record RecActionDto
|
||||
|
||||
public string? PostprocessingQuery { get; init; }
|
||||
|
||||
public string? ErrorAction { get; init; }
|
||||
|
||||
public UriBuilder ToEndpointUriBuilder()
|
||||
{
|
||||
var builder = EndpointUri is null ? new UriBuilder() : new UriBuilder(EndpointUri);
|
||||
|
||||
@@ -18,6 +18,16 @@ public class InvokeRecActionsCommandHandler(ISender sender) : IRequestHandler<In
|
||||
var actions = await sender.Send(request.ToReadQuery(q => q.Invoked = false), cancel);
|
||||
|
||||
foreach (var action in actions)
|
||||
await sender.Send(action.ToInvokeCommand(), cancel);
|
||||
{
|
||||
var ok = await sender.Send(action.ToInvokeCommand(), cancel);
|
||||
if (!ok)
|
||||
switch (action.ErrorAction?.ToLowerInvariant())
|
||||
{
|
||||
case "continue":
|
||||
break;
|
||||
default:
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user