Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1262)

Unified Diff: scripts/common/cros_chromite.py

Issue 2108713004: chromite: check response status code (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/tools/build
Patch Set: fix request Created 4 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: scripts/common/cros_chromite.py
diff --git a/scripts/common/cros_chromite.py b/scripts/common/cros_chromite.py
index d98de3f2e5097b3a14f5b2d59b2cb81761a16ca5..0b34559cac156983039117a0f740d1ee6007cb28 100755
--- a/scripts/common/cros_chromite.py
+++ b/scripts/common/cros_chromite.py
@@ -500,10 +500,15 @@ class ChromiteFetcher(object):
# Force no authentication. Chromite is public! By default, 'requests' will
# use 'netrc' for authentication. This can cause the load to fail if
# the '.netrc' has an invalid entry, failing authentication.
- return requests.get(
+ res = requests.get(
url,
verify=True,
- auth=lambda r: r).text
+ auth=lambda r: r)
+ if res.status_code != 200:
+ raise GitilesError(
+ url, 'Unexpected HTTP status code %d; body: %s' % (
+ res.status_code, res.text))
+ return res.text
except requests.exceptions.RequestException as e:
raise GitilesError(url, 'Request raised exception: %s' % (e,))
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698