| 126 | error: Optional[OAuthErrorCode] |
| 127 | |
| 128 | def __init__(self, *, response: httpx.Response, body: object | None) -> None: |
| 129 | message = "OAuth authentication error." |
| 130 | error = None |
| 131 | |
| 132 | if is_dict(body): |
| 133 | error = body.get("error") |
| 134 | description = body.get("error_description") |
| 135 | if description and isinstance(description, str): |
| 136 | message = description |
| 137 | |
| 138 | super().__init__(message, response=response, body=body) |
| 139 | self.error = cast(Optional[OAuthErrorCode], error) |
| 140 | |
| 141 | |
| 142 | class PermissionDeniedError(APIStatusError): |