-
-
Notifications
You must be signed in to change notification settings - Fork 1.9k
Fix API break when contents not found #3181
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
Conversation
Felixoid
left a comment
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.
Looks good, I'd like to have it merged to have reliable UnknownObjectException
| elif status == 403 and cls.isRateLimitError(message): | ||
| exc = GithubException.RateLimitExceededException | ||
| elif status == 404 and message == "not found": | ||
| elif status == 404 and (message == "not found" or "no object found" in message): |
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.
| elif status == 404 and (message == "not found" or "no object found" in message): | |
| elif status == 404 and (message == "not found" or "no object found" in message.lower()): |
It will fail for the cases when message is "No object found for the path <path>"
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.
message is lowercase already, see above, the test uses "No object found ..." and passes.
|
EDIT: Just noticed that the sibling PR is taking this exact route |
EnricoMi
left a comment
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!
|
Will a new tag be released? |
Alternative to #3180 that fixes #3179, but tries to preserve existing behavior.
UnknownObjectException is raised for all kinds of calls that may return a 404, for example get_repo. Those API calls still return a "Not Found" message:
So, in this PR we honor both kinds of messages, but still no other kinds of messages.
Tests are updated to reflect the new case.