Mercurial > public > mercurial-scm > hg-stable
comparison mercurial/error.py @ 23415:cdbb85489c41 stable
hook: raise a more specialized HookAbort exception when a hook fails
We need to gracefully handle some aborts for pushkey, especially
because it leads to a user-facing crash over the wireprotocols. So we
need a more specialized exception to catch.
author | Pierre-Yves David <pierre-yves.david@fb.com> |
---|---|
date | Sat, 29 Nov 2014 19:13:35 -0800 |
parents | 2bd51e61c65e |
children | 10d02cd18604 |
comparison
equal
deleted
inserted
replaced
23414:759202b64f49 | 23415:cdbb85489c41 |
---|---|
45 class Abort(Exception): | 45 class Abort(Exception): |
46 """Raised if a command needs to print an error and exit.""" | 46 """Raised if a command needs to print an error and exit.""" |
47 def __init__(self, *args, **kw): | 47 def __init__(self, *args, **kw): |
48 Exception.__init__(self, *args) | 48 Exception.__init__(self, *args) |
49 self.hint = kw.get('hint') | 49 self.hint = kw.get('hint') |
50 | |
51 class HookAbort(Abort): | |
52 """raised when a validation hook fails, aborting an operation | |
53 | |
54 Exists to allow more specialized catching.""" | |
55 pass | |
50 | 56 |
51 class ConfigError(Abort): | 57 class ConfigError(Abort): |
52 """Exception raised when parsing config files""" | 58 """Exception raised when parsing config files""" |
53 | 59 |
54 class OutOfBandError(Exception): | 60 class OutOfBandError(Exception): |