Table of Contents

Class CircuitBreakerOpenException

Namespace
LMKit.Agents.Resilience
Assembly
LM-Kit.NET.dll

Exception thrown when a circuit breaker is open.

public sealed class CircuitBreakerOpenException : Exception, ISerializable
Inheritance
CircuitBreakerOpenException
Implements
Inherited Members

Examples

Detecting an open breaker and falling back to a cached response:

using LMKit.Agents.Resilience;

try { return await breaker.ExecuteAsync(ct => agent.RunAsync(input, ct)); } catch (CircuitBreakerOpenException ex) { Console.WriteLine($"Circuit open (last error: {ex.TriggeringException?.Message}); serving cache."); return cachedResult; }

Constructors

CircuitBreakerOpenException(string, Exception)

Initializes a new instance of the CircuitBreakerOpenException class.

Properties

TriggeringException

Gets the exception that caused the circuit to open.

Share