[docs]classResourceNotSupportedError(AnmokuException):def__init__(self,resource:Type[JikanResource],not_supported:str):super().__init__(f"The '{resource.__name__}' resource does not support {not_supported}!")
[docs]classResourceRequiresError(AnmokuException):def__init__(self,resource:Type[JikanResource],parameter_required:str):super().__init__(f"The '{resource.__name__}' resource requires the keyword parameter '{parameter_required}' to be passed! " \
f"E.g. client.get(resource, id = 1, {parameter_required} = 1)")
[docs]classHTTPError(AnmokuException):__slots__=("status","type","message","report_url",)def__init__(self,resp:ErrorResponseDict):self.type:str=resp["type"]self.status:int=resp["status"]self.message:str=resp["message"]self.report_url:Optional[str]=resp.get("report_url")# TODO: error trace?message=f"{self.type} (status code {self.status}): {self.message}"ifself.report_urlisnotNone:message+=f"\nYou can report this issue to the Jikan API via GitHub: {self.report_url}"super().__init__(message)