upload_symbols: Allow retry loop to raise exception

The method that executes all HTTP requests is currently raising an
exception if the request throws an error, which is then handled by the
try block and falls out of the retry loop.  Allow the retry loop to
handle the exception, which will allow for things like timeouts to be
retried in the future.

BUG=chromium:956599
TEST='cros_sdk -- /mnt/host/source/chromite/run_tests'

Change-Id: Ib081f9d1b1e143a8a50ed19242071aa21a0a4063
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/chromite/+/1584228
Reviewed-by: Sean Abraham <seanabraham@chromium.org>
Reviewed-by: Dhanya Ganesh <dhanyaganesh@chromium.org>
Reviewed-by: Mike Nichols <mikenichols@chromium.org>
Reviewed-by: Chris McDonald <cjmcdonald@chromium.org>
Tested-by: Mike Nichols <mikenichols@chromium.org>
Commit-Queue: Mike Nichols <mikenichols@chromium.org>
(cherry picked from commit cf5b7a9b39d66020c7d0eff2a06f3fbb2119d969)
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/chromite/+/1584645
Reviewed-by: Daniel Gagnon <dgagnon@google.com>
diff --git a/scripts/upload_symbols.py b/scripts/upload_symbols.py
index 77e77e7..7d2f699 100644
--- a/scripts/upload_symbols.py
+++ b/scripts/upload_symbols.py
@@ -350,11 +350,11 @@
   # Make sure we don't leak secret keys by accident.
   if resp.status_code > 399:
     resp.url = resp.url.replace(urllib2.quote(api_key), 'XX-HIDDEN-XX')
-    logging.error('Url: %s, Status: %s, response: "%s", in: %s',
-                  resp.url, resp.status_code, resp.text, resp.elapsed)
-    resp.raise_for_status()
-  if resp.content:
+    logging.warning('Url: %s, Status: %s, response: "%s", in: %s',
+                    resp.url, resp.status_code, resp.text, resp.elapsed)
+  elif resp.content:
     return resp.json()
+
   return {}
 
 
@@ -438,8 +438,7 @@
         # This command retries the upload multiple times with growing delays.
         # We only consider the upload a failure if these retries fail.
         def ShouldRetryUpload(exception):
-          return isinstance(exception, (requests.exceptions.HTTPError,
-                                        requests.exceptions.RequestException,
+          return isinstance(exception, (requests.exceptions.RequestException,
                                         urllib2.URLError,
                                         httplib.HTTPException, socket.error))