Patchwork [4,of,4] client: raise ResponseError in _readchannel()

login
register
mail settings
Submitter Gábor Stefanik
Date Aug. 21, 2017, 4:06 p.m.
Message ID <6f59b1f3360d599dfe66.1503331583@GSTEFANIK.NavnGo.local>
Download mbox | patch
Permalink /patch/23184/
State Accepted
Headers show

Comments

Gábor Stefanik - Aug. 21, 2017, 4:06 p.m.
# HG changeset patch
# User Gábor Stefanik <gabor.stefanik@nng.com>
# 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.
Augie Fackler - Aug. 28, 2017, 6:29 p.m.
On Mon, Aug 21, 2017 at 06:06:23PM +0200, Gábor Stefanik wrote:
> # HG changeset patch
> # User Gábor Stefanik <gabor.stefanik@nng.com>
> # Date 1503328417 -7200
> #      Mon Aug 21 17:13:37 2017 +0200
> # Node ID 6f59b1f3360d599dfe66cf509bbde926d87ebe5e
> # Parent  8b4d606b49655d44091c2689a3f35a3fff17a28d
> client: raise ResponseError in _readchannel()

queued, thanks
Augie Fackler - Aug. 28, 2017, 6:31 p.m.
On Mon, Aug 21, 2017 at 06:06:23PM +0200, Gábor Stefanik wrote:
> # HG changeset patch
> # User Gábor Stefanik <gabor.stefanik@nng.com>
> # Date 1503328417 -7200
> #      Mon Aug 21 17:13:37 2017 +0200
> # Node ID 6f59b1f3360d599dfe66cf509bbde926d87ebe5e
> # Parent  8b4d606b49655d44091c2689a3f35a3fff17a28d
> client: raise ResponseError in _readchannel()

Hmmm, I'm trying to apply these and I'm getting failed hunks in this
first patch. Can you resend?

(Sorry about the delay and the trouble.)

>
> 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.
>
> 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
> ________________________________
>  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.
> _______________________________________________
> Mercurial-devel mailing list
> Mercurial-devel@mercurial-scm.org
> https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
Gábor Stefanik - Aug. 30, 2017, 1:50 p.m.
> -----Original Message-----
> From: Augie Fackler [mailto:raf@durin42.com]
> Sent: Monday, August 28, 2017 8:32 PM
> To: Gábor STEFANIK <Gabor.STEFANIK@nng.com>
> Cc: mercurial-devel@mercurial-scm.org
> Subject: Re: [PATCH 4 of 4] client: raise ResponseError in _readchannel()
>
> On Mon, Aug 21, 2017 at 06:06:23PM +0200, Gábor Stefanik wrote:
> > # HG changeset patch
> > # User Gábor Stefanik <gabor.stefanik@nng.com> # Date 1503328417 -7200
> > #      Mon Aug 21 17:13:37 2017 +0200
> > # Node ID 6f59b1f3360d599dfe66cf509bbde926d87ebe5e
> > # Parent  8b4d606b49655d44091c2689a3f35a3fff17a28d
> > client: raise ResponseError in _readchannel()
>
> Hmmm, I'm trying to apply these and I'm getting failed hunks in this first
> patch. Can you resend?
>
> (Sorry about the delay and the trouble.)

Probably CR characters in the patch. I can do nothing about them, our new SMTP server appears to do this on its own.

Try dos2unixing the patch before applying.

>
> >
> > 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.
> >
> > 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
> > ________________________________
> >  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.
> > _______________________________________________
> > Mercurial-devel mailing list
> > Mercurial-devel@mercurial-scm.org
> > https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
Augie Fackler - Sept. 12, 2017, 5:19 p.m.
> On Aug 30, 2017, at 09:50, Gábor STEFANIK <Gabor.STEFANIK@nng.com> wrote:
> 
>> -----Original Message-----
>> From: Augie Fackler [mailto:raf@durin42.com]
>> Sent: Monday, August 28, 2017 8:32 PM
>> To: Gábor STEFANIK <Gabor.STEFANIK@nng.com>
>> Cc: mercurial-devel@mercurial-scm.org
>> Subject: Re: [PATCH 4 of 4] client: raise ResponseError in _readchannel()
>> 
>> On Mon, Aug 21, 2017 at 06:06:23PM +0200, Gábor Stefanik wrote:
>>> # HG changeset patch
>>> # User Gábor Stefanik <gabor.stefanik@nng.com> # Date 1503328417 -7200
>>> #      Mon Aug 21 17:13:37 2017 +0200
>>> # Node ID 6f59b1f3360d599dfe66cf509bbde926d87ebe5e
>>> # Parent  8b4d606b49655d44091c2689a3f35a3fff17a28d
>>> client: raise ResponseError in _readchannel()
>> 
>> Hmmm, I'm trying to apply these and I'm getting failed hunks in this first
>> patch. Can you resend?
>> 
>> (Sorry about the delay and the trouble.)
> 
> Probably CR characters in the patch. I can do nothing about them, our new SMTP server appears to do this on its own.
> 
> Try dos2unixing the patch before applying.

Gross. That was the problem, they're queued. I'll endeavor to have a place to push them this week.

Thanks.

> 
>> 
>>> 
>>> 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.
>>> 
>>> 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
>>> ________________________________
>>> 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.
>>> _______________________________________________
>>> Mercurial-devel mailing list
>>> Mercurial-devel@mercurial-scm.org
>>> https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
> ________________________________
> 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/ <http://www.nng.com/emailpolicy/>
> By responding to this email you accept the email policy.

Patch

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