From patchwork Mon Aug 21 16:06:23 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Subject: [4,of,4] client: raise ResponseError in _readchannel() From: =?utf-8?q?G=C3=A1bor_Stefanik?= X-Patchwork-Id: 23184 Message-Id: <6f59b1f3360d599dfe66.1503331583@GSTEFANIK.NavnGo.local> To: mercurial-devel@mercurial-scm.org Date: Mon, 21 Aug 2017 18:06:23 +0200 # HG changeset patch # User Gábor Stefanik # Date 1503328417 -7200 # Mon Aug 21 17:13:37 2017 +0200 # Node ID 6f59b1f3360d599dfe66cf509bbde926d87ebe5e # Parent 8b4d606b49655d44091c2689a3f35a3fff17a28d 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. ________________________________ 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. diff -r 8b4d606b4965 -r 6f59b1f3360d hglib/client.py --- 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