# HG changeset patch # User Siddharth Agarwal # Date 1447145205 28800 # Node ID 5e46123e6c352a01e7adf1785baeb9849e9a2534 # Parent fc41f9ffd4a4dd2268bad644e92fb2dc1fa15f40 error: add structured exception for EOF at prompt We'll catch this exception for promptchoice queries to provide better error handling. diff -r fc41f9ffd4a4 -r 5e46123e6c35 mercurial/error.py --- a/mercurial/error.py Mon Nov 09 22:37:32 2015 -0800 +++ b/mercurial/error.py Tue Nov 10 00:46:45 2015 -0800 @@ -72,6 +72,12 @@ class UpdateAbort(Abort): """Raised when an update is aborted for destination issue""" +class ResponseExpected(Abort): + """Raised when an EOF is received for a prompt""" + def __init__(self): + from .i18n import _ + Abort.__init__(self, _('response expected')) + class OutOfBandError(Exception): """Exception raised when a remote repo reports failure""" diff -r fc41f9ffd4a4 -r 5e46123e6c35 mercurial/ui.py --- a/mercurial/ui.py Mon Nov 09 22:37:32 2015 -0800 +++ b/mercurial/ui.py Tue Nov 10 00:46:45 2015 -0800 @@ -756,7 +756,7 @@ self.write(r, "\n") return r except EOFError: - raise error.Abort(_('response expected')) + raise error.ResponseExpected() @staticmethod def extractchoices(prompt): @@ -803,7 +803,7 @@ else: return getpass.getpass('') except EOFError: - raise error.Abort(_('response expected')) + raise error.ResponseExpected() def status(self, *msg, **opts): '''write status message to output (if ui.quiet is False)