ContinueOnFailureExecutor
NexusLabs.Needlr.AgentFramework.Workflows¶
NexusLabs.Needlr.AgentFramework.Workflows.Sequential¶
ContinueOnFailureExecutor Class¶
Wraps an inner executor, catching exceptions and returning a failed result instead of throwing. This enables "advisory" stage behavior where a failure does not halt the pipeline.
public sealed class ContinueOnFailureExecutor : NexusLabs.Needlr.AgentFramework.Workflows.Sequential.IStageExecutor
Inheritance System.Object 🡒 ContinueOnFailureExecutor
Implements IStageExecutor
Example¶
var safeExecutor = new ContinueOnFailureExecutor(
innerExecutor,
ex => logger.LogWarning(ex, "Stage failed but continuing"));
var result = await safeExecutor.ExecuteAsync(context, cancellationToken);
// result.Succeeded == false if the inner executor threw, but no exception propagates.
Constructors¶
ContinueOnFailureExecutor(IStageExecutor, Action<Exception>) Constructor¶
Wraps an inner executor, catching exceptions and returning a failed result instead of throwing. This enables "advisory" stage behavior where a failure does not halt the pipeline.
public ContinueOnFailureExecutor(NexusLabs.Needlr.AgentFramework.Workflows.Sequential.IStageExecutor inner, System.Action<System.Exception>? onFailure=null);
Parameters¶
inner IStageExecutor
The executor to wrap.
onFailure System.Action<System.Exception>
Optional callback invoked when the inner executor throws.
Example¶
var safeExecutor = new ContinueOnFailureExecutor(
innerExecutor,
ex => logger.LogWarning(ex, "Stage failed but continuing"));
var result = await safeExecutor.ExecuteAsync(context, cancellationToken);
// result.Succeeded == false if the inner executor threw, but no exception propagates.
Methods¶
ContinueOnFailureExecutor.ExecuteAsync(StageExecutionContext, CancellationToken) Method¶
Executes the stage logic and returns a result indicating success or failure.
public System.Threading.Tasks.Task<NexusLabs.Needlr.AgentFramework.Workflows.Sequential.StageExecutionResult> ExecuteAsync(NexusLabs.Needlr.AgentFramework.Workflows.Sequential.StageExecutionContext context, System.Threading.CancellationToken cancellationToken);
Parameters¶
context StageExecutionContext
The execution context providing access to shared pipeline state.
cancellationToken System.Threading.CancellationToken
Token to observe for cancellation.
Implements ExecuteAsync(StageExecutionContext, CancellationToken)
Returns¶
System.Threading.Tasks.Task<StageExecutionResult>
A StageExecutionResult describing the outcome.