Exceptions
Circuit Breaker exceptions.
| CLASS | DESCRIPTION |
|---|---|
CircuitBreakerConfigError |
Raised when |
CircuitBreakerError |
Base error class. |
CircuitBreakerOpenError |
Raised when the circuit is open and no |
CircuitBreakerPersistenceError |
Raised by a persistence backend for an unrecoverable store error on a write path |
CircuitBreakerConfigError ¶
CircuitBreakerConfigError(*args: str | Exception | None)
Bases: CircuitBreakerError
Raised when CircuitBreakerConfig is built with an unsupported combination of
options (for example, both handled_exceptions and ignored_exceptions).
Source code in aws_lambda_powertools/utilities/circuit_breaker_alpha/exceptions.py
21 22 23 | |
CircuitBreakerError ¶
CircuitBreakerError(*args: str | Exception | None)
Bases: Exception
Base error class.
Overrides message/details formatting so the printed exception stays readable. See https://github.com/aws-powertools/powertools-lambda-python/issues/1772
Source code in aws_lambda_powertools/utilities/circuit_breaker_alpha/exceptions.py
21 22 23 | |
CircuitBreakerOpenError ¶
CircuitBreakerOpenError(*args: str | Exception | None, circuit: CircuitInfo | None = None)
Bases: CircuitBreakerError
Raised when the circuit is open and no on_circuit_open callback is registered.
The rejected request never reached the downstream. The circuit snapshot is attached so the caller can decide how to respond.
| PARAMETER | DESCRIPTION |
|---|---|
*args
|
Standard error message/details. |
circuit
|
Snapshot of the circuit at rejection time.
TYPE:
|
Example
Handling an open circuit when no callback is registered
1 2 3 4 5 | |
Source code in aws_lambda_powertools/utilities/circuit_breaker_alpha/exceptions.py
57 58 59 | |
CircuitBreakerPersistenceError ¶
CircuitBreakerPersistenceError(*args: str | Exception | None)
Bases: CircuitBreakerError
Raised by a persistence backend for an unrecoverable store error on a write path (persisting a state transition), where there is no safe local fallback.
Reads never raise this: get_state fails open (treats the circuit as closed) and
only logs, so a degraded store can never become the outage the breaker is meant to
prevent. Custom backends may raise this from their write primitives.
Source code in aws_lambda_powertools/utilities/circuit_breaker_alpha/exceptions.py
21 22 23 | |