GeezerVisonThe World Wide Web, restored to 800 pixels of glory. |
| Home|About|Gaming cabinet|Archives|How it works|Starter sites |
GeezerVison is showing github.com — cycles-client-python/runcycles/exceptions.py at main · runcycles/cycles-client-python Expand file tree/ Copy pathexceptions.pyMore file actions 105 lines (72 loc) · 3.43 KB / Copy pathexceptions.pyFile metadata and controls105 lines (72 loc) · 3.43 KB 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 """Exception hierarchy for the Cycles client.""" from __future__ import annotations from typing import Any class CyclesError(Exception): """Base exception for all Cycles client errors.""" class CyclesProtocolError(CyclesError): """Raised when the Cycles server returns a protocol-level error.""" def __init__( self, message: str, *, status: int = 0, error_code: str | None = None, reason_code: str | None = None, retry_after_ms: int | None = None, request_id: str | None = None, details: dict[str, Any] | None = None, ) -> None: super().__init__(message) self.status = status self.error_code = error_code self.reason_code = reason_code self.retry_after_ms = retry_after_ms self.request_id = request_id self.details = details def is_budget_exceeded(self) -> bool: return self.error_code == "BUDGET_EXCEEDED" def is_overdraft_limit_exceeded(self) -> bool: return self.error_code == "OVERDRAFT_LIMIT_EXCEEDED" def is_debt_outstanding(self) -> bool: return self.error_code == "DEBT_OUTSTANDING" def is_tenant_closed(self) -> bool: return self.error_code == "TENANT_CLOSED" def is_reservation_expired(self) -> bool: return self.error_code == "RESERVATION_EXPIRED" def is_reservation_finalized(self) -> bool: return self.error_code == "RESERVATION_FINALIZED" def is_idempotency_mismatch(self) -> bool: return self.error_code == "IDEMPOTENCY_MISMATCH" def is_unit_mismatch(self) -> bool: return self.error_code == "UNIT_MISMATCH" def is_retryable(self) -> bool: # LIMIT_EXCEEDED (HTTP 429 rate limiting, runtime spec v0.1.25.12) # is transient: retry after retry_after_ms / Retry-After. return self.error_code in ("INTERNAL_ERROR", "UNKNOWN", "LIMIT_EXCEEDED") or self.status >= 500 class BudgetExceededError(CyclesProtocolError): """Raised when budget is insufficient for the reservation.""" class OverdraftLimitExceededError(CyclesProtocolError): """Raised when debt exceeds the overdraft limit.""" class DebtOutstandingError(CyclesProtocolError): """Raised when outstanding debt blocks new reservations.""" class TenantClosedError(CyclesProtocolError): """Raised when the owning tenant is CLOSED (HTTP 409, ``TENANT_CLOSED``). Servers return this on reservation create/commit/release/extend when the owning tenant's status is CLOSED, per runtime spec v0.1.25.13 (mirrors governance spec Rule 2). Not retryable — the tenant must be reopened administratively before further budget operations succeed. """ class ReservationExpiredError(CyclesProtocolError): """Raised when operating on an expired reservation.""" class ReservationFinalizedError(CyclesProtocolError): """Raised when operating on an already-finalized reservation.""" class CyclesTransportError(CyclesError): """Transport-level error (connection timeout, DNS failure, etc.). Exported for use in application code; the SDK itself surfaces transport failures as ``CyclesProtocolError`` with ``status == -1`` (decorator and ``stream_reservation`` paths) or ``CyclesResponse.transport_error`` (programmatic client) rather than raising this class. """ def __init__(self, message: str, *, cause: Exception | None = None) -> None: super().__init__(message) self.cause = cause |
| You are visitor 01402792 — GeezerVison does not store the pages you look up. Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required. |