Class FallbackOptions<TResult>

Namespace
Kevlar
Assembly
Kevlar.dll

Configures result-typed notifications for a fallback strategy on a Shield<TResult>.

public sealed class FallbackOptions<TResult>

Type Parameters

TResult
Inheritance
FallbackOptions<TResult>
Inherited Members

Remarks

After an outcome is selected for recovery, Kevlar records the fallback metric, invokes and awaits OnFallback, and then runs the recovery factory. Notification failures are reported through OnCallbackError and do not skip recovery. Without an ambient clause or local handling override, fallback handles ordinary exceptions and ExecutionRejectedException instances while letting cancellation and fatal runtime exceptions propagate.

Constructors

FallbackOptions()

public FallbackOptions()

Properties

HandlesException

Setting this — or HandlesResult — makes this fallback ignore the ambient When… handling clause; this predicate then selects the exceptions it handles.

public Func<Exception, bool>? HandlesException { get; set; }

Property Value

Func<Exception, bool>

Remarks

The ambient clause is started with When… on a shield and continued with Or… on the builder it returns, and applies to every reactive strategy chained after it. These properties replace that clause for this strategy alone; they do not narrow it.

See Also

HandlesExceptionContext

Locally handles exceptions using the typed outcome and execution context.

public Func<HandlingEvent<TResult>, bool>? HandlesExceptionContext { get; set; }

Property Value

Func<HandlingEvent<TResult>, bool>

HandlesResult

Setting this — or HandlesException — makes this fallback ignore the ambient When… handling clause; this predicate then selects the results it handles.

public Func<TResult, bool>? HandlesResult { get; set; }

Property Value

Func<TResult, bool>

Remarks

The ambient clause is started with When…/WhenResult… on a shield and continued with Or… on the builder it returns, and applies to every reactive strategy chained after it. These properties replace that clause for this strategy alone; they do not narrow it.

See Also

HandlesResultContext

Locally handles results using the typed outcome and execution context.

public Func<HandlingEvent<TResult>, bool>? HandlesResultContext { get; set; }

Property Value

Func<HandlingEvent<TResult>, bool>

Name

An optional low-cardinality name used by strategy telemetry.

public string? Name { get; set; }

Property Value

string

OnFallback

Invoked and awaited before the recovery factory, with the typed handled outcome. Return default from a synchronous callback.

public Func<FallbackEvent<TResult>, ValueTask>? OnFallback { get; set; }

Property Value

Func<FallbackEvent<TResult>, ValueTask>