File size: 1,371 Bytes
c446951 |
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 |
from typing import Optional
class HTTPClientError(Exception):
pass
class HTTPCallErrorError(HTTPClientError):
def __init__(
self,
description: str,
status_code: int,
api_message: Optional[str],
):
super().__init__(description)
self.__description = description
self.__api_message = api_message
self.__status_code = status_code
@property
def description(self) -> str:
return self.__description
@property
def api_message(self) -> str:
return self.__api_message
@property
def status_code(self) -> int:
return self.__status_code
def __repr__(self) -> str:
return (
f"{self.__class__.__name__}("
f"description='{self.description}', "
f"api_message='{self.api_message}',"
f"status_code={self.__status_code})"
)
def __str__(self) -> str:
return self.__repr__()
class InvalidInputFormatError(HTTPClientError):
pass
class InvalidModelIdentifier(HTTPClientError):
pass
class ModelNotInitializedError(HTTPClientError):
pass
class ModelTaskTypeNotSupportedError(HTTPClientError):
pass
class ModelNotSelectedError(HTTPClientError):
pass
class EncodingError(HTTPClientError):
pass
class WrongClientModeError(HTTPClientError):
pass
|