Mercurial > python-hglib
comparison hglib/client.py @ 190:f38bc0569671
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.
author | Gábor Stefanik <gabor.stefanik@nng.com> |
---|---|
date | Mon, 21 Aug 2017 17:06:13 +0200 |
parents | 8054e925d9c7 |
children | 6987d6cd420c |
comparison
equal
deleted
inserted
replaced
189:8054e925d9c7 | 190:f38bc0569671 |
---|---|
257 raise ValueError('server already open') | 257 raise ValueError('server already open') |
258 | 258 |
259 self.server = util.popen(self._args, self._env) | 259 self.server = util.popen(self._args, self._env) |
260 try: | 260 try: |
261 self._readhello() | 261 self._readhello() |
262 except error.ResponseError: | |
263 self.close() | |
264 raise | |
262 except error.ServerError: | 265 except error.ServerError: |
263 ret, serr = self._close() | 266 ret, serr = self._close() |
264 raise error.ServerError('server exited with status %d: %s' | 267 raise error.ServerError('server exited with status %d: %s' |
265 % (ret, serr.strip())) | 268 % (ret, serr.strip())) |
266 return self | 269 return self |