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
Make Requester.__createException robust against missing message and body #2159
Make Requester.__createException robust against missing message and body #2159
Conversation
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions. |
Codecov ReportPatch coverage:
❗ Your organization is not using the GitHub App Integration. As a result you may experience degraded service beginning May 15th. Please install the Github App Integration for your organization. Read more. Additional details and impacted files@@ Coverage Diff @@
## master #2159 +/- ##
=======================================
Coverage 98.68% 98.68%
=======================================
Files 117 117
Lines 11825 11826 +1
=======================================
+ Hits 11670 11671 +1
Misses 155 155
☔ View full report in Codecov by Sentry. |
e508688
to
563ad66
Compare
563ad66
to
07fd134
Compare
@s-t-e-v-e-n-k what do you think, can we get this merged? |
07fd134
to
1c2da8b
Compare
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.
LGTM!
@@ -452,26 +452,26 @@ def __customConnection(self, url): | |||
return cnx | |||
|
|||
def __createException(self, status, headers, output): | |||
if status == 401 and output.get("message") == "Bad credentials": | |||
message = output.get("message", "").lower() if output is not None else "" |
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.
Good idea making this case insensitive! 👍
This adds tests for
Requester.__createException
while making this method robust againstoutput
missing"message"
andoutput = None
for all status.Note: This simplifies logic while making
BadCredentialsException
,BadUserAgentException
andUnknownObjectException
case-insensitive to the message.Fixes #1399 and #2158.
Note: Add that extra message from #2127 to
tests.Requester.testShouldCreateRateLimitExceededException
, either in that PR or here, whatever gets merged last.