Table of Contents

Class FaultGenerator

Namespace
Polly.Simmy.Fault
Assembly
Polly.Core.dll

A generator for creating faults (exceptions) using registered delegate functions.

public sealed class FaultGenerator
Inheritance
FaultGenerator
Inherited Members

Remarks

An instance of this class can be assigned to the FaultGenerator property.

Constructors

FaultGenerator()

Initializes a new instance of the FaultGenerator class.

public FaultGenerator()

Methods

AddException(Func<ResilienceContext, Exception>, int)

Registers an exception generator delegate that accepts a ResilienceContext.

public FaultGenerator AddException(Func<ResilienceContext, Exception> generator, int weight = 100)

Parameters

generator Func<ResilienceContext, Exception>

The delegate that generates the exception, accepting a ResilienceContext.

weight int

The weight assigned to this generator. Defaults to 100.

Returns

FaultGenerator

The current instance of FaultGenerator.

AddException(Func<Exception>, int)

Registers an exception generator delegate.

public FaultGenerator AddException(Func<Exception> generator, int weight = 100)

Parameters

generator Func<Exception>

The delegate that generates the exception.

weight int

The weight assigned to this generator. Defaults to 100.

Returns

FaultGenerator

The current instance of FaultGenerator.

AddException<TException>(int)

Registers an exception generator for a specific exception type, using the default constructor of that exception.

public FaultGenerator AddException<TException>(int weight = 100) where TException : Exception, new()

Parameters

weight int

The weight assigned to this generator. Defaults to 100.

Returns

FaultGenerator

The current instance of FaultGenerator.

Type Parameters

TException

The type of the exception to generate.