about summary refs log tree commit diff
diff options
context:
space:
mode:
authorYuki Okushi <huyuumi.dev@gmail.com>2020-08-24 11:48:49 +0900
committerGitHub <noreply@github.com>2020-08-24 11:48:49 +0900
commitd6de9616a16fa5c078836fb0b39173a1d0cc9d58 (patch)
tree6fdd508ec80474066c619851c76eaa43d9237d4d
parent25a677ccef5f355184a835aa2ba39380724a77ef (diff)
parent2e6f2e885506ee46ea32622e33fe74d99774cf57 (diff)
downloadrust-d6de9616a16fa5c078836fb0b39173a1d0cc9d58.tar.gz
rust-d6de9616a16fa5c078836fb0b39173a1d0cc9d58.zip
Rollup merge of #75844 - ehuss:publish-toolstate-httperror, 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: https://github.com/rust-lang/rust/pull/75815#issuecomment-678798158
-rwxr-xr-xsrc/tools/publish_toolstate.py10
1 files changed, 9 insertions, 1 deletions
diff --git a/src/tools/publish_toolstate.py b/src/tools/publish_toolstate.py
index 72b3df8377a..51416c8ce63 100755
--- a/src/tools/publish_toolstate.py
+++ b/src/tools/publish_toolstate.py
@@ -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')
@@ -342,3 +342,11 @@ if __name__ == '__main__':
         }
     ))
     response.read()
+
+
+if __name__ == '__main__':
+    try:
+        main()
+    except urllib2.HTTPError as e:
+        print("HTTPError: %s\n%s" % (e, e.read()))
+        raise