Mercurial > public > mercurial-scm > hg-stable
diff mercurial/hook.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 | b009dd135aa0 |
children | 19ebd2f88fc7 |
line wrap: on
line diff
--- a/mercurial/hook.py Mon Dec 01 15:04:34 2014 -0600 +++ b/mercurial/hook.py Sat Nov 29 19:13:35 2014 -0800 @@ -7,7 +7,7 @@ from i18n import _ import os, sys, time -import extensions, util, demandimport +import extensions, util, demandimport, error def _pythonhook(ui, repo, name, hname, funcname, args, throw): '''call python hook. hook is callable object, looked up as @@ -107,7 +107,7 @@ name, funcname, duration) if r: if throw: - raise util.Abort(_('%s hook failed') % hname) + raise error.HookAbort(_('%s hook failed') % hname) ui.warn(_('warning: %s hook failed\n') % hname) return r @@ -142,7 +142,7 @@ if r: desc, r = util.explainexit(r) if throw: - raise util.Abort(_('%s hook %s') % (name, desc)) + raise error.HookAbort(_('%s hook %s') % (name, desc)) ui.warn(_('warning: %s hook %s\n') % (name, desc)) return r