class GatewayError(RuntimeError):
    pass


class RateLimitedError(GatewayError):
    def __init__(self, *, scope: str, phase: str | None = None) -> None:
        self.scope = scope
        self.phase = phase
        super().__init__(f"rate limited: {scope} phase={phase or 'n/a'}")


class NoCapacityError(GatewayError):
    def __init__(self, *, model: str) -> None:
        self.model = model
        super().__init__(f"no capacity for model {model}")
