Bug 1168535 - Print error response body in upload_symbols.py. r=gps, a=NPOTB
authorTed Mielczarek <ted@mielczarek.org>
Wed, 27 May 2015 13:50:04 -0400
changeset 273393 61093ea985b6d4bc74056ec23e37f43ee205faaa
parent 273392 0cd5f3f55ededfd3b69dd8fbe3adf25ab1f5db5b
child 273394 9c9b478fcb51f2e71935b7749cf09627cdeb6f5b
push id4830
push userjlund@mozilla.com
push dateMon, 29 Jun 2015 20:18:48 +0000
treeherdermozilla-beta@4c2175bb0420 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersgps, NPOTB
bugs1168535
milestone40.0a2
Bug 1168535 - Print error response body in upload_symbols.py. r=gps, a=NPOTB
Makefile.in
toolkit/crashreporter/tools/upload_symbols.py
--- a/Makefile.in
+++ b/Makefile.in
@@ -249,17 +249,17 @@ ifdef MOZ_CRASHREPORTER
 	  mv $(SYMBOL_INDEX_NAME).tmp $(SYMBOL_INDEX_NAME)
 	cd $(DIST)/crashreporter-symbols && \
           zip -r9D '../$(PKG_PATH)$(SYMBOL_ARCHIVE_BASENAME).zip' . -i '*.sym' -i '*.txt'  -x '*test*' -x '*Test*'
 endif # MOZ_CRASHREPORTER
 
 uploadsymbols:
 ifdef MOZ_CRASHREPORTER
 ifdef SOCORRO_SYMBOL_UPLOAD_TOKEN_FILE
-	$(PYTHON) $(topsrcdir)/toolkit/crashreporter/tools/upload_symbols.py '$(DIST)/$(PKG_PATH)$(SYMBOL_FULL_ARCHIVE_BASENAME).zip'
+	$(PYTHON) -u $(topsrcdir)/toolkit/crashreporter/tools/upload_symbols.py '$(DIST)/$(PKG_PATH)$(SYMBOL_FULL_ARCHIVE_BASENAME).zip'
 else
 	$(SHELL) $(topsrcdir)/toolkit/crashreporter/tools/upload_symbols.sh $(SYMBOL_INDEX_NAME) '$(DIST)/$(PKG_PATH)$(SYMBOL_FULL_ARCHIVE_BASENAME).zip'
 endif
 endif
 
 # MOZ_SOURCE_STAMP is defined in package-name.mk with a deferred assignment.
 # exporting it makes make run its $(shell) command for each invoked submake,
 # so transform it to an immediate assignment.
--- a/toolkit/crashreporter/tools/upload_symbols.py
+++ b/toolkit/crashreporter/tools/upload_symbols.py
@@ -57,21 +57,28 @@ def main():
                 allow_redirects=False,
                 timeout=120)
     except requests.exceptions.RequestException as e:
         print('Error: {0}'.format(e))
         return 1
 
     if r.status_code >= 200 and r.status_code < 300:
         print('Uploaded successfully!')
-    elif r.status_code < 400:
-        print('Error: bad auth token? ({0})'.format(r.status_code),
+        return 0
+
+    if r.status_code < 400:
+        print('Error: bad auth token? ({0}: {1})'.format(r.status_code,
+                                                         r.reason),
               file=sys.stderr)
-        return 1
     else:
-        print('Error: got HTTP response {0}'.format(r.status_code),
+        print('Error: got HTTP response {0}: {1}'.format(r.status_code,
+                                                         r.reason),
               file=sys.stderr)
-        return 1
-    return 0
+
+    print('Response body:\n{sep}\n{body}\n{sep}\n'.format(
+        sep='=' * 20,
+        body=r.text
+        ))
+    return 1
 
 if __name__ == '__main__':
     sys.exit(main())