| 5 | |
| 6 | |
| 7 | class HTTPException(Exception): |
| 8 | def __init__(self, status_code: int, detail: str | None = None, headers: Mapping[str, str] | None = None) -> None: |
| 9 | if detail is None: |
| 10 | detail = http.HTTPStatus(status_code).phrase |
| 11 | self.status_code = status_code |
| 12 | self.detail = detail |
| 13 | self.headers = headers |
| 14 | |
| 15 | def __str__(self) -> str: |
| 16 | return f"{self.status_code}: {self.detail}" |
| 17 | |
| 18 | def __repr__(self) -> str: |
| 19 | class_name = self.__class__.__name__ |
| 20 | return f"{class_name}(status_code={self.status_code!r}, detail={self.detail!r})" |
| 21 | |
| 22 | |
| 23 | class WebSocketException(Exception): |
no outgoing calls