Skip to content

common_rates.errors

Why a limiter did not admit a call: the one exception family.

Admission has two outcomes, granted or refused, and the granted one is a wait. So refusal raises, which is exactly what an HTTP client’s admission hook expects: wait, or reject by raising.

Classes

LimiterError

Bases: RuntimeError

A limiter could not admit a call.

Refused

Bases: LimiterError

The wait a quota demanded exceeds what the caller allows.

__init__

def __init__(scope: Scope, quota: str | None, wait: float, max_wait: float) -> None

Fields and properties declared here; inherited members belong to the bases above.

max_wait

max_wait = max_wait

quota

quota = quota

scope

scope = scope

wait

wait = wait

Unavailable

Bases: LimiterError

The shared backend could not be reached, and the policy refuses without it.

Undeclared

Bases: LimiterError

No quotas are declared for the scope; a limiter never guesses a vendor’s limits.

__init__

def __init__(scope: Scope) -> None

Fields and properties declared here; inherited members belong to the bases above.

scope

scope = scope