mirror of
https://github.com/facebook/sapling.git
synced 2024-10-07 23:38:50 +03:00
error: add structured exception for EOF at prompt
We'll catch this exception for promptchoice queries to provide better error handling.
This commit is contained in:
parent
c1dff75209
commit
6e6f3927e3
@ -72,6 +72,12 @@ class ConfigError(Abort):
|
||||
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"""
|
||||
|
||||
|
@ -756,7 +756,7 @@ class ui(object):
|
||||
self.write(r, "\n")
|
||||
return r
|
||||
except EOFError:
|
||||
raise error.Abort(_('response expected'))
|
||||
raise error.ResponseExpected()
|
||||
|
||||
@staticmethod
|
||||
def extractchoices(prompt):
|
||||
@ -803,7 +803,7 @@ class ui(object):
|
||||
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)
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user