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

login
register
mail settings
Submitter Gábor Stefanik
Date Aug. 21, 2017, 3:19 p.m.
Message ID <8b4d606b49655d44091c.1503328741@GSTEFANIK.NavnGo.local>
Download mbox | patch
Permalink /patch/23190/
State Superseded
Headers show

Comments

Gábor Stefanik - Aug. 21, 2017, 3:19 p.m.
# HG changeset patch
# User Gábor Stefanik <gabor.stefanik@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.

________________________________
 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.

Patch

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'