Table of Contents

Class TransientFaultException

Namespace
Cuemon.Resilience
Assembly
Cuemon.Core.dll

The exception that is thrown when a transient fault handling was unsuccessful.

public class TransientFaultException : Exception, ISerializable
Inheritance
TransientFaultException
Implements
Inherited Members

Examples

The following example demonstrates how to construct a with retry evidence.

using System;
using System.Reflection;
using Cuemon.Reflection;
using Cuemon.Resilience;

namespace MyApp.Examples;

public static class TransientFaultExceptionExample
{
    public static void Demonstrate()
    {
        var evidence = new TransientFaultEvidence(
            attempts: 5,
            recoveryWaitTime: TimeSpan.FromSeconds(2),
            totalRecoveryWaitTime: TimeSpan.FromSeconds(10),
            latency: TimeSpan.FromSeconds(1),
            descriptor: MethodDescriptor.Create(MethodBase.GetCurrentMethod()!));

        var exception = new TransientFaultException("Operation failed after retries.", evidence);

        Console.WriteLine(exception.Message);
        Console.WriteLine(exception.Evidence.Attempts);
        Console.WriteLine(exception.Evidence.TotalRecoveryWaitTime);
    }
}

Constructors

TransientFaultException()

Initializes a new instance of the TransientFaultException class.

public TransientFaultException()

TransientFaultException(string, TransientFaultEvidence)

Initializes a new instance of the TransientFaultException class.

public TransientFaultException(string message, TransientFaultEvidence evidence)

Parameters

message string

The message that describes the error.

evidence TransientFaultEvidence

The evidence that provide details about the transient fault.

TransientFaultException(string, Exception, TransientFaultEvidence)

Initializes a new instance of the TransientFaultException class.

public TransientFaultException(string message, Exception innerException, TransientFaultEvidence evidence)

Parameters

message string

The message that describes the error.

innerException Exception

The exception that is the cause of the current exception. If the innerException parameter is not a null reference, the current exception is raised in a catch block that handles the inner exception.

evidence TransientFaultEvidence

The evidence that provide details about the transient fault.

Properties

Evidence

Gets the evidence that provide details about the transient fault of this instance.

public TransientFaultEvidence Evidence { get; }

Property Value

TransientFaultEvidence

The evidence that provide details about the transient fault.

Methods

ToString()

Returns a string that represents this instance.

public override string ToString()

Returns

string

A string that represents this instance.