Mercurial > python-hglib
annotate hglib/error.py @ 189:8054e925d9c7
client: kill the server on unrecoverable communication errors (issue5516)
Once an unrecoverable communication error occurs between the client and server,
it's no longer safe to send further commands to the same server.
On Windows, attempting to do so is known to cause lockups and memory leaks.
Close the client and kill the server when an such an error occurs. This way,
any further commands will fail gracefully with ValueError until the client
is reopened.
author | Gábor Stefanik <gabor.stefanik@nng.com> |
---|---|
date | Mon, 21 Aug 2017 17:02:14 +0200 |
parents | 59cb26bf866e |
children |
rev | line source |
---|---|
0 | 1 class CommandError(Exception): |
2 def __init__(self, args, ret, out, err): | |
3 self.args = args | |
4 self.ret = ret | |
5 self.out = out | |
6 self.err = err | |
7 | |
36
00bb0701323a
error: return stderr as __str__ for CommandError
Idan Kamara <idankk86@gmail.com>
parents:
0
diff
changeset
|
8 def __str__(self): |
117
59cb26bf866e
error: show more info on CommandError's __str__
Idan Kamara <idankk86@gmail.com>
parents:
36
diff
changeset
|
9 return str((self.ret, self.out.rstrip(), self.err.rstrip())) |
36
00bb0701323a
error: return stderr as __str__ for CommandError
Idan Kamara <idankk86@gmail.com>
parents:
0
diff
changeset
|
10 |
0 | 11 class ServerError(Exception): |
12 pass | |
13 | |
14 class ResponseError(ServerError, ValueError): | |
15 pass | |
16 | |
17 class CapabilityError(ServerError): | |
18 pass |