diff hglib/client.py @ 191:6987d6cd420c

client: raise ResponseError in _readchannel() Make it clearer that this is an unrecoverable communication error. ServerError alone is not always unrecoverable, as CapabilityError is considered a subtype of it. This way, a caller can check for ResponseError to identify errors that require reopening the client to recover.
author Gábor Stefanik <gabor.stefanik@nng.com>
date Mon, 21 Aug 2017 17:13:37 +0200
parents f38bc0569671
children 7a84a8656679
line wrap: on
line diff
--- a/hglib/client.py	Mon Aug 21 17:06:13 2017 +0200
+++ b/hglib/client.py	Mon Aug 21 17:13:37 2017 +0200
@@ -140,7 +140,7 @@
         data = self.server.stdout.read(hgclient.outputfmtsize)
         if not data:
             self.close()
-            raise error.ServerError()
+            raise error.ResponseError('no response received from server')
         channel, length = struct.unpack(hgclient.outputfmt, data)
         if channel in b('IL'):
             return channel, length