Skip to content

ReplExecutionOutcomeKind

Classifies how a top-level run ended, independently of the exit code eventually returned. Values are explicit and append-only so consumers can persist or switch on them safely.

public enum ReplExecutionOutcomeKind

Handler arguments could not be bound: a token failed to convert or was missing, or a value the binder resolves itself (context value, [FromServices] dependency, typed global options service) was unavailable.

BindingError = 3

ReplExecutionOutcomeKind

The caller’s own CancellationToken stopped the run — already cancelled at the call, during the command, or while hosted services were starting.

One-shot and interactive runs draw the line differently, deliberately. In a one-shot run only the caller’s token yields this kind: a handler that raises OperationCanceledException on its own account is a HandlerException, so a real failure cannot pass for an operator abort. An interactive session instead treats a command-scoped OperationCanceledException as an abort — Ctrl+C and a self-cancelling handler alike: it prints Cancelled. and decorates the command-end mark with this kind’s code rather than rendering the exception.

Two interactive cases are not this kind at all, and neither carries a code: an abandoned prompt (empty line, Escape, end of input), and a cancellation of the session’s own token — host shutdown — which propagates out of the loop after closing the cycle with an aborted mark.

Cancelled = 7

ReplExecutionOutcomeKind

The handler ran to completion and returned an ICompletedWithFailuresResult: the command did its job, and what it reports contains failures (tests that failed, records that were rejected). Distinct from HandlerError, where the command itself failed.

CompletedWithFailures = 10

ReplExecutionOutcomeKind

The framework itself failed: an incompatible adapter contract, an unsupported hosting capability, or a hosted service that could not start or stop. The outcome carries the exception when one caused it.

FrameworkError = 9

ReplExecutionOutcomeKind

The handler ran and returned a failure result (error, validation, not_found, …).

HandlerError = 4

ReplExecutionOutcomeKind

The handler, a middleware, or user code running after binding (validators, banners, output transformers) threw an exception that the framework reported.

HandlerException = 6

ReplExecutionOutcomeKind

The handler returned an IExitResult; its exit code is used verbatim.

HandlerExitCode = 5

ReplExecutionOutcomeKind

The invocation rendered help instead of running a command: help request, bare invocation, or scoped-context help.

Help = 1

ReplExecutionOutcomeKind

The run was interrupted by a process signal (SIGINT, Ctrl+Break, SIGTERM) that the framework claimed, which standalone runs opt into through ReplRunOptions.ProcessSignalHandling. The core pipeline never produces it on its own: an interruption is decided by the signal owner around the run, and only a clean or cancelled run is reclassified — one that already produced a refusal or a failure keeps reporting it.

Interrupted = 8

ReplExecutionOutcomeKind

The handler completed and produced a success-like result (or no result); also an ambient command (exit, ..) that did its job, and a clean interactive session exit.

Success = 0

ReplExecutionOutcomeKind

The framework refused the invocation before the handler ran: unknown command, ambiguous prefix, invalid option, unknown output format, or context validation failure.

UsageError = 2

ReplExecutionOutcomeKind