PyBreaker exposes a single exception class —Documentation Index
Fetch the complete documentation index at: https://mintlify.com/danielfm/pybreaker/llms.txt
Use this file to discover all available pages before exploring further.
CircuitBreakerError — and three
string constants that represent the circuit’s possible states. Understanding
both is essential for writing correct error-handling code and for initialising
or inspecting storage backends.
CircuitBreakerError
CircuitBreakerError inherits directly from Exception. It is raised in two
distinct situations:
-
A call is made to a function protected by an already-open circuit. The
breaker short-circuits immediately without invoking the guarded function and
raises
CircuitBreakerErrorwith the message"Timeout not elapsed yet, circuit breaker still open". -
The circuit trips (i.e., the failure count reaches
fail_max) andthrow_new_error_on_trip=True(the default). The breaker opens and raisesCircuitBreakerErrorwith the message"Failures threshold reached, circuit breaker opened".
When
throw_new_error_on_trip=False, the original exception is
re-raised at the moment the circuit trips, so the first failing call that
opens the breaker will surface the underlying error rather than a
CircuitBreakerError. However, all subsequent calls while the circuit
remains open will still raise CircuitBreakerError. Keep this asymmetry in
mind when writing catch blocks.State Constants
PyBreaker exports three string constants that represent the three possible circuit states:All Public Exports
All public symbols can be imported directly from thepybreaker package:
