bug 1168535 - print error response body in upload_symbols.py. r?gps draft
authorTed Mielczarek <ted@mielczarek.org>
Wed, 27 May 2015 13:50:04 -0400
changeset 268053 3d70a156280c91e4934ec0da60f2d8db2638064c
parent 267933 ff2e0722804149cc85a6f4a26ae9983a10e4800c
child 268054 1f01910a42fd33cfb5d316f17c44fc940475134d
push id2299
push usertmielczarek@mozilla.com
push dateWed, 27 May 2015 17:50:18 +0000
reviewersgps
bugs1168535
milestone41.0a1
bug 1168535 - print error response body in upload_symbols.py. r?gps
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())