@@ -8,7 +8,13 @@ class LivepeerGatewayError(RuntimeError):
88
99
1010class LivepeerHTTPError (LivepeerGatewayError ):
11- """Raised when an HTTP endpoint returns a non-success status."""
11+ """Raised when an HTTP request returns a non-success response.
12+
13+ Attributes:
14+ status_code: HTTP status code returned by the endpoint.
15+ url: Endpoint that produced the error.
16+ body: Raw response body, when available.
17+ """
1218
1319 def __init__ (self , status_code : int , url : str , body : str = "" , message : str | None = None ) -> None :
1420 self .status_code = int (status_code )
@@ -19,28 +25,53 @@ def __init__(self, status_code: int, url: str, body: str = "", message: str | No
1925
2026@dataclass
2127class OrchestratorRejection :
22- """Records a single orchestrator that was tried and rejected."""
28+ """A single orchestrator that was tried during selection and rejected.
29+
30+ Attributes:
31+ url: Endpoint URL of the orchestrator that was attempted.
32+ reason: Human-readable explanation of why it was rejected.
33+ """
2334 url : str
2435 reason : str
2536
2637
2738@dataclass
2839class RunnerRejection :
29- """Records a single runner that was tried and rejected."""
40+ """A single runner that was tried during selection and rejected.
41+
42+ Attributes:
43+ url: Endpoint URL of the runner that was attempted.
44+ reason: Human-readable explanation of why it was rejected.
45+ """
3046 url : str
3147 reason : str
3248
3349
3450class NoOrchestratorAvailableError (LivepeerGatewayError ):
35- """Raised when no orchestrator could be selected."""
51+ """Raised when orchestrator selection rejects every candidate.
52+
53+ Attributes:
54+ rejections: Each orchestrator that was tried and why it was rejected.
55+ """
3656
3757 def __init__ (self , message : str , rejections : list [OrchestratorRejection ] | None = None ) -> None :
3858 super ().__init__ (message )
3959 self .rejections : list [OrchestratorRejection ] = rejections or []
4060
61+ def __str__ (self ) -> str :
62+ message = super ().__str__ ()
63+ if not self .rejections :
64+ return message
65+ reasons = "; " .join (f"{ r .url } : { r .reason } " for r in self .rejections )
66+ return f"{ message } : { reasons } "
67+
4168
4269class NoRunnerAvailableError (LivepeerGatewayError ):
43- """Raised when no runner could be selected."""
70+ """Raised when runner selection rejects every candidate.
71+
72+ Attributes:
73+ rejections: Each runner that was tried and why it was rejected.
74+ """
4475
4576 def __init__ (self , message : str , rejections : list [RunnerRejection ] | None = None ) -> None :
4677 super ().__init__ (message )
@@ -55,7 +86,11 @@ def __str__(self) -> str:
5586
5687
5788class SignerRefreshRequired (LivepeerGatewayError ):
58- """Raised when the remote signer returns HTTP 480 and a refresh is required."""
89+ """Raised when the remote signer requests a credential refresh.
90+
91+ Attributes:
92+ orchestrator_url: Orchestrator whose signer requested the refresh, if known.
93+ """
5994
6095 def __init__ (
6196 self ,
0 commit comments