Exceptions
from limitpal import (
RateLimitExceeded, # acquire() timed out
InvalidConfigError, # bad constructor args
CircuitBreakerOpen, # circuit breaker blocking
RetryExhausted, # retries exhausted
)
RateLimitExceeded
Raised when acquire(key, timeout) times out.
InvalidConfigError
Raised for invalid constructor arguments (e.g. negative capacity).
try:
TokenBucket(capacity=-1, refill_rate=1.0)
except InvalidConfigError as e:
print(e.parameter, e.value, e.reason)
CircuitBreakerOpen
Raised by ResilientExecutor when the circuit breaker is open.
RetryExhausted
Raised when all retries failed (with RetryPolicy).
All of these inherit from LimitPalError.