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 201212 882d5e18eef435ca158fe906619130ad2c5a068b
parent 201211 b585afd5db9316c897ca3377588f4b8b7a89f7b0
child 201213 a31be6d7406f81519e9242929701e35450439b61
push id280
push userryanvm@gmail.com
push dateThu, 04 Jun 2015 20:27:19 +0000
treeherdermozilla-esr31@917d8e07d42b [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersgps, NPOTB
bugs1168535
milestone31.7.0
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
@@ -239,17 +239,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())