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:
parent
cad7916da6
commit
f71c0db13b
4 changed files with 11 additions and 13 deletions
|
@ -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)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue