1
Fork 0
mirror of https://github.com/RGBCube/GitHubWrapper synced 2025-05-16 14:15:00 +00:00

Move utils.error_from_request to errors.py and fix circular imports

This commit is contained in:
RGBCube 2022-06-25 14:22:52 +03:00
parent cad7916da6
commit f71c0db13b
4 changed files with 11 additions and 13 deletions

View file

@ -1,6 +1,6 @@
from __future__ import annotations
__all__ = ("GitHubError", "BaseHTTPError", "HTTPError", "RatelimitReached")
__all__ = ("GitHubError", "BaseHTTPError", "HTTPError", "RatelimitReached", "error_from_request")
from datetime import datetime, timezone
from typing import TYPE_CHECKING
@ -46,3 +46,7 @@ class RatelimitReached(GitHubError):
"The ratelimit has been reached. You can try again in"
f" {human_readable_time_until(datetime.now(timezone.utc) - self.reset_time)}"
)
def error_from_request(request: ClientResponse, /) -> BaseHTTPError:
# TODO: Make specific errrors
return HTTPError(request)