Skip to content

Commit

Permalink
Rollup merge of rust-lang#75844 - ehuss:publish-toolstate-httperror, …
Browse files Browse the repository at this point in the history
…r=Mark-Simulacrum

publish-toolstate: show more context on HTTP error

The default display for HTTPError in Python does not include the request body. For GitHub API, the body includes more details about the error (like rate limiting). This could help diagnosing errors like this: rust-lang#75815 (comment)
  • Loading branch information
JohnTitor committed Aug 24, 2020
2 parents 25a677c + 2e6f2e8 commit d6de961
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion src/tools/publish_toolstate.py
Original file line number Diff line number Diff line change
Expand Up @@ -275,7 +275,7 @@ def update_latest(
return message


if __name__ == '__main__':
def main():
repo = os.environ.get('TOOLSTATE_VALIDATE_MAINTAINERS_REPO')
if repo:
github_token = os.environ.get('TOOLSTATE_REPO_ACCESS_TOKEN')
Expand Down Expand Up @@ -342,3 +342,11 @@ def update_latest(
}
))
response.read()


if __name__ == '__main__':
try:
main()
except urllib2.HTTPError as e:
print("HTTPError: %s\n%s" % (e, e.read()))
raise

0 comments on commit d6de961

Please sign in to comment.