-
Notifications
You must be signed in to change notification settings - Fork 5
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
HTTP Requests response status code handlings #42
base: main
Are you sure you want to change the base?
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
a first review about new RateLimiter exceptions
class RLRequestFailed(RateLimiterError): | ||
def __init__(self, request, *args, **kwargs): | ||
super().__init__(request, *args, **kwargs) | ||
|
||
class RLRequestClientError(RLRequestFailed): | ||
def __init__(self, request, *args, **kwargs): | ||
super().__init__(request, *args, **kwargs) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maybe RLClientError
, RLClientError4xx
would be a better name?
(same with Server)
class RLRequestClientError(RLRequestFailed): | ||
def __init__(self, request, *args, **kwargs): | ||
super().__init__(request, *args, **kwargs) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maybe RLClientError
, RLClientError4xx
would be a better name?
(same with Server)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
also the name RLRequestServerError
wrongly give the impression of inheriting from RLRequestFailed
class RLRequestFailed(RateLimiterError): | ||
def __init__(self, request, *args, **kwargs): | ||
super().__init__(request, *args, **kwargs) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If I'm not mistaken the whole point of this exception is to allow future subclassing (because today only RLRequestClientError
inherits from it)
However it made the code a bit more obscure (especially because you except
the parent class not this one)
So in the interest of readability maybe we could get rid of this one and instead except RLClientError
later?
…, server error mean longer time to wait, client error means request failed
…ass the exception to calling process
b284a6d
to
4b72f13
Compare
4b72f13
to
9121289
Compare
The goal of this PR is to close #41 & close #28.
This aims to make the bot handle more HTTP responde status codes, 40X errors that mean there is a problem with the request and 50X errors that means there is a problem on server side.