You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
24 lines
703 B
Python
24 lines
703 B
Python
from __future__ import annotations
|
|
|
|
|
|
class ServiceClientError(RuntimeError):
|
|
"""Base service-client error."""
|
|
|
|
|
|
class ServiceConfigError(ServiceClientError):
|
|
"""Raised when service client configuration is missing or invalid."""
|
|
|
|
|
|
class ServiceUnavailableError(ServiceClientError):
|
|
"""Raised when a service cannot be reached or is temporarily blocked."""
|
|
|
|
|
|
class ServiceHTTPError(ServiceClientError):
|
|
"""Raised for non-2xx HTTP responses."""
|
|
|
|
def __init__(self, service: str, status_code: int, body: str) -> None:
|
|
self.service = service
|
|
self.status_code = status_code
|
|
self.body = body
|
|
super().__init__(f"service {service} returned HTTP {status_code}")
|