error: Add a hint argument to RepoError

This use the same mechanism than Abort. Except clause stay distinct
because RepoError add "!" at the end of the message.
This commit is contained in:
Pierre-Yves David 2011-06-25 02:30:17 +02:00
parent 748bbc348d
commit f95a6cfc12
2 changed files with 5 additions and 1 deletions

View File

@ -125,6 +125,8 @@ def _runcatch(req):
commands.help_(ui, 'shortlist')
except error.RepoError, inst:
ui.warn(_("abort: %s!\n") % inst)
if inst.hint:
ui.warn(_("(%s)\n") % inst.hint)
except error.ResponseError, inst:
ui.warn(_("abort: %s") % inst.args[0])
if not isinstance(inst.args[1], basestring):

View File

@ -43,7 +43,9 @@ class ParseError(Exception):
'Exception raised when parsing config files (msg[, pos])'
class RepoError(Exception):
pass
def __init__(self, *args, **kw):
Exception.__init__(self, *args)
self.hint = kw.get('hint')
class RepoLookupError(RepoError):
pass