BrokenCircuitException
Exception thrown when a circuit is broken.
using System;
using System.Runtime.CompilerServices;
namespace Polly.CircuitBreaker
{
[NullableContext(1)]
[Nullable(0)]
public class BrokenCircuitException : ExecutionRejectedException
{
internal const string DefaultMessage = "The circuit is now open and is not allowing calls.";
public TimeSpan? RetryAfter { get; }
public BrokenCircuitException()
: base("The circuit is now open and is not allowing calls.")
{
}
public BrokenCircuitException(TimeSpan retryAfter)
{
DefaultInterpolatedStringHandler defaultInterpolatedStringHandler = new DefaultInterpolatedStringHandler(78, 1);
defaultInterpolatedStringHandler.AppendLiteral("The circuit is now open and is not allowing calls. It can be retried after '");
defaultInterpolatedStringHandler.AppendFormatted(retryAfter);
defaultInterpolatedStringHandler.AppendLiteral("'.");
base..ctor(defaultInterpolatedStringHandler.ToStringAndClear());
RetryAfter = retryAfter;
}
public BrokenCircuitException(string message)
: base(message)
{
}
public BrokenCircuitException(string message, TimeSpan retryAfter)
: base(message)
{
RetryAfter = retryAfter;
}
public BrokenCircuitException(string message, Exception inner)
: base(message, inner)
{
}
public BrokenCircuitException(string message, TimeSpan retryAfter, Exception inner)
: base(message, inner)
{
RetryAfter = retryAfter;
}
}
}