comparison mercurial/ui.py @ 26896:5e46123e6c35

error: add structured exception for EOF at prompt We'll catch this exception for promptchoice queries to provide better error handling.
author Siddharth Agarwal <sid0@fb.com>
date Tue, 10 Nov 2015 00:46:45 -0800
parents 71d5238f92e9
children 9eeca021a803
comparison
equal deleted inserted replaced
26895:fc41f9ffd4a4 26896:5e46123e6c35
754 r = default 754 r = default
755 if self.configbool('ui', 'promptecho'): 755 if self.configbool('ui', 'promptecho'):
756 self.write(r, "\n") 756 self.write(r, "\n")
757 return r 757 return r
758 except EOFError: 758 except EOFError:
759 raise error.Abort(_('response expected')) 759 raise error.ResponseExpected()
760 760
761 @staticmethod 761 @staticmethod
762 def extractchoices(prompt): 762 def extractchoices(prompt):
763 """Extract prompt message and list of choices from specified prompt. 763 """Extract prompt message and list of choices from specified prompt.
764 764
801 if self.configbool('ui', 'nontty'): 801 if self.configbool('ui', 'nontty'):
802 return self.fin.readline().rstrip('\n') 802 return self.fin.readline().rstrip('\n')
803 else: 803 else:
804 return getpass.getpass('') 804 return getpass.getpass('')
805 except EOFError: 805 except EOFError:
806 raise error.Abort(_('response expected')) 806 raise error.ResponseExpected()
807 def status(self, *msg, **opts): 807 def status(self, *msg, **opts):
808 '''write status message to output (if ui.quiet is False) 808 '''write status message to output (if ui.quiet is False)
809 809
810 This adds an output label of "ui.status". 810 This adds an output label of "ui.status".
811 ''' 811 '''