[PATCH 3 of 4] client: don't swallow ResponseError inside open()

Gábor Stefanik gabor.stefanik at nng.com
Mon Aug 21 12:06:22 EDT 2017


# HG changeset patch
# User Gábor Stefanik <gabor.stefanik at nng.com>
# Date 1503327973 -7200
#      Mon Aug 21 17:06:13 2017 +0200
# Node ID 8b4d606b49655d44091c2689a3f35a3fff17a28d
# Parent  e2b082707b44c5d9f630bf0ca722723bad8cefb1
client: don't swallow ResponseError inside open()

_readhello() can generate meaningful ResponseError exceptions. However,
open()'s exception handler swallows these, converting them into generic
ServerErrors. Allow the original ResponseErrors to pass through.

diff -r e2b082707b44 -r 8b4d606b4965 hglib/client.py
--- a/hglib/client.py   Mon Aug 21 17:02:14 2017 +0200
+++ b/hglib/client.py   Mon Aug 21 17:06:13 2017 +0200
@@ -259,6 +259,9 @@
         self.server = util.popen(self._args, self._env)
         try:
             self._readhello()
+        except error.ResponseError:
+            self.close()
+            raise
         except error.ServerError:
             ret, serr = self._close()
             raise error.ServerError('server exited with status %d: %s'
________________________________
 This message, including its attachments, is confidential and the property of NNG Llc. For more information please read NNG's email policy here:
http://www.nng.com/emailpolicy/
By responding to this email you accept the email policy.


More information about the Mercurial-devel mailing list