annotate hglib/error.py @ 127:53387d1e620b

client: connect to repo if necessary when using "with" statement While the '__exit__' closes the connection to the server, the __enter__ method does not open it. Without this patch, a disconnected repo cannot be used with a context managed unless you explicitely call the "open" method.
author Paul Tonelli <paul.tonelli@logilab.fr>
date Mon, 16 Jun 2014 18:29:06 +0200
parents 59cb26bf866e
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
0
79f88b4db15f Initial commit
Idan Kamara <idankk86@gmail.com>
parents:
diff changeset
1 class CommandError(Exception):
79f88b4db15f Initial commit
Idan Kamara <idankk86@gmail.com>
parents:
diff changeset
2 def __init__(self, args, ret, out, err):
79f88b4db15f Initial commit
Idan Kamara <idankk86@gmail.com>
parents:
diff changeset
3 self.args = args
79f88b4db15f Initial commit
Idan Kamara <idankk86@gmail.com>
parents:
diff changeset
4 self.ret = ret
79f88b4db15f Initial commit
Idan Kamara <idankk86@gmail.com>
parents:
diff changeset
5 self.out = out
79f88b4db15f Initial commit
Idan Kamara <idankk86@gmail.com>
parents:
diff changeset
6 self.err = err
79f88b4db15f Initial commit
Idan Kamara <idankk86@gmail.com>
parents:
diff changeset
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
79f88b4db15f Initial commit
Idan Kamara <idankk86@gmail.com>
parents:
diff changeset
11 class ServerError(Exception):
79f88b4db15f Initial commit
Idan Kamara <idankk86@gmail.com>
parents:
diff changeset
12 pass
79f88b4db15f Initial commit
Idan Kamara <idankk86@gmail.com>
parents:
diff changeset
13
79f88b4db15f Initial commit
Idan Kamara <idankk86@gmail.com>
parents:
diff changeset
14 class ResponseError(ServerError, ValueError):
79f88b4db15f Initial commit
Idan Kamara <idankk86@gmail.com>
parents:
diff changeset
15 pass
79f88b4db15f Initial commit
Idan Kamara <idankk86@gmail.com>
parents:
diff changeset
16
79f88b4db15f Initial commit
Idan Kamara <idankk86@gmail.com>
parents:
diff changeset
17 class CapabilityError(ServerError):
79f88b4db15f Initial commit
Idan Kamara <idankk86@gmail.com>
parents:
diff changeset
18 pass