changeset 36430:efebfa9b4cab

httppeer: explicitly catch urlerr.httperror and re-raise On Python 3 it seems urllib.error.HTTPError doesn't set the .args field of the exception to have any contents, which then breaks our socket.error catch. This works around that issue. Differential Revision: https://phab.mercurial-scm.org/D2448
author Augie Fackler <augie@google.com>
date Mon, 26 Feb 2018 00:50:35 -0500
parents f8ea6988a5fb
children ec43960b03e8
files mercurial/httppeer.py
diffstat 1 files changed, 5 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/mercurial/httppeer.py	Mon Feb 26 00:49:33 2018 -0500
+++ b/mercurial/httppeer.py	Mon Feb 26 00:50:35 2018 -0500
@@ -439,6 +439,11 @@
             if len(vals) < 2:
                 raise error.ResponseError(_("unexpected response:"), r)
             return vals
+        except urlerr.httperror:
+            # Catch and re-raise these so we don't try and treat them
+            # like generic socket errors. They lack any values in
+            # .args on Python 3 which breaks our socket.error block.
+            raise
         except socket.error as err:
             if err.args[0] in (errno.ECONNRESET, errno.EPIPE):
                 raise error.Abort(_('push failed: %s') % err.args[1])