Class FallbackSyntax
- Namespace
- Polly
- Assembly
- Polly.dll
Fluent API for defining a Fallback Policy.
public static class FallbackSyntax
- Inheritance
-
FallbackSyntax
- Inherited Members
Methods
Fallback(PolicyBuilder, Action)
Builds a FallbackPolicy which provides a fallback action if the main execution fails. Executes the main delegate, but if this throws a handled exception, calls fallbackAction.
public static FallbackPolicy Fallback(this PolicyBuilder policyBuilder, Action fallbackAction)
Parameters
policyBuilderPolicyBuilderThe policy builder.
fallbackActionActionThe fallback action.
Returns
- FallbackPolicy
The policy instance.
Exceptions
- ArgumentNullException
fallbackAction
Fallback(PolicyBuilder, Action, Action<Exception, Context>)
Builds a FallbackPolicy which provides a fallback action if the main execution fails. Executes the main delegate, but if this throws a handled exception, first calls onFallback with details of the handled exception and the execution context; then calls fallbackAction.
[Obsolete("This overload is deprecated and will be removed in a future release. Prefer the overload in which both fallbackAction and onFallback take a Context input parameter.")]
public static FallbackPolicy Fallback(this PolicyBuilder policyBuilder, Action fallbackAction, Action<Exception, Context> onFallback)
Parameters
policyBuilderPolicyBuilderThe policy builder.
fallbackActionActionThe fallback action.
onFallbackAction<Exception, Context>The action to call before invoking the fallback delegate.
Returns
- FallbackPolicy
The policy instance.
Exceptions
- ArgumentNullException
fallbackAction
- ArgumentNullException
onFallback
Fallback(PolicyBuilder, Action, Action<Exception>)
Builds a FallbackPolicy which provides a fallback action if the main execution fails. Executes the main delegate, but if this throws a handled exception, first calls onFallback with details of the handled exception; then calls fallbackAction.
public static FallbackPolicy Fallback(this PolicyBuilder policyBuilder, Action fallbackAction, Action<Exception> onFallback)
Parameters
policyBuilderPolicyBuilderThe policy builder.
fallbackActionActionThe fallback action.
onFallbackAction<Exception>The action to call before invoking the fallback delegate.
Returns
- FallbackPolicy
The policy instance.
Exceptions
- ArgumentNullException
fallbackAction
- ArgumentNullException
onFallback
Fallback(PolicyBuilder, Action<Context, CancellationToken>, Action<Exception, Context>)
Builds a FallbackPolicy which provides a fallback action if the main execution fails. Executes the main delegate, but if this throws a handled exception, first calls onFallback with details of the handled exception and the execution context; then calls fallbackAction.
public static FallbackPolicy Fallback(this PolicyBuilder policyBuilder, Action<Context, CancellationToken> fallbackAction, Action<Exception, Context> onFallback)
Parameters
policyBuilderPolicyBuilderThe policy builder.
fallbackActionAction<Context, CancellationToken>The fallback action.
onFallbackAction<Exception, Context>The action to call before invoking the fallback delegate.
Returns
- FallbackPolicy
The policy instance.
Exceptions
- ArgumentNullException
fallbackAction
- ArgumentNullException
onFallback
Fallback(PolicyBuilder, Action<Context>, Action<Exception, Context>)
Builds a FallbackPolicy which provides a fallback action if the main execution fails. Executes the main delegate, but if this throws a handled exception, first calls onFallback with details of the handled exception and the execution context; then calls fallbackAction.
public static FallbackPolicy Fallback(this PolicyBuilder policyBuilder, Action<Context> fallbackAction, Action<Exception, Context> onFallback)
Parameters
policyBuilderPolicyBuilderThe policy builder.
fallbackActionAction<Context>The fallback action.
onFallbackAction<Exception, Context>The action to call before invoking the fallback delegate.
Returns
- FallbackPolicy
The policy instance.
Exceptions
- ArgumentNullException
fallbackAction
- ArgumentNullException
onFallback
Fallback(PolicyBuilder, Action<Exception, Context, CancellationToken>, Action<Exception, Context>)
Builds a FallbackPolicy which provides a fallback action if the main execution fails. Executes the main delegate, but if this throws a handled exception, first calls onFallback with details of the handled exception and the execution context; then calls fallbackAction.
public static FallbackPolicy Fallback(this PolicyBuilder policyBuilder, Action<Exception, Context, CancellationToken> fallbackAction, Action<Exception, Context> onFallback)
Parameters
policyBuilderPolicyBuilderThe policy builder.
fallbackActionAction<Exception, Context, CancellationToken>The fallback action.
onFallbackAction<Exception, Context>The action to call before invoking the fallback delegate.
Returns
- FallbackPolicy
The policy instance.
Exceptions
- ArgumentNullException
fallbackAction
- ArgumentNullException
onFallback
Fallback(PolicyBuilder, Action<CancellationToken>)
Builds a FallbackPolicy which provides a fallback action if the main execution fails. Executes the main delegate, but if this throws a handled exception, calls fallbackAction.
public static FallbackPolicy Fallback(this PolicyBuilder policyBuilder, Action<CancellationToken> fallbackAction)
Parameters
policyBuilderPolicyBuilderThe policy builder.
fallbackActionAction<CancellationToken>The fallback action.
Returns
- FallbackPolicy
The policy instance.
Exceptions
- ArgumentNullException
fallbackAction
Fallback(PolicyBuilder, Action<CancellationToken>, Action<Exception, Context>)
Builds a FallbackPolicy which provides a fallback action if the main execution fails. Executes the main delegate, but if this throws a handled exception, first calls onFallback with details of the handled exception and the execution context; then calls fallbackAction.
[Obsolete("This overload is deprecated and will be removed in a future release. Prefer the overload in which both fallbackAction and onFallback take a Context input parameter.")]
public static FallbackPolicy Fallback(this PolicyBuilder policyBuilder, Action<CancellationToken> fallbackAction, Action<Exception, Context> onFallback)
Parameters
policyBuilderPolicyBuilderThe policy builder.
fallbackActionAction<CancellationToken>The fallback action.
onFallbackAction<Exception, Context>The action to call before invoking the fallback delegate.
Returns
- FallbackPolicy
The policy instance.
Exceptions
- ArgumentNullException
fallbackAction
- ArgumentNullException
onFallback
Fallback(PolicyBuilder, Action<CancellationToken>, Action<Exception>)
Builds a FallbackPolicy which provides a fallback action if the main execution fails. Executes the main delegate, but if this throws a handled exception, first calls onFallback with details of the handled exception; then calls fallbackAction.
public static FallbackPolicy Fallback(this PolicyBuilder policyBuilder, Action<CancellationToken> fallbackAction, Action<Exception> onFallback)
Parameters
policyBuilderPolicyBuilderThe policy builder.
fallbackActionAction<CancellationToken>The fallback action.
onFallbackAction<Exception>The action to call before invoking the fallback delegate.
Returns
- FallbackPolicy
The policy instance.
Exceptions
- ArgumentNullException
fallbackAction
- ArgumentNullException
onFallback