##// END OF EJS Templates
dispatch: extract common logic for handling ParseError...
Jun Wu -
r28515:491eabd0 default
parent child Browse files
Show More
@@ -81,6 +81,8 b' def _formatparse(write, inst):'
81 else:
81 else:
82 write(_("hg: parse error: %s\n") % inst.args[0])
82 write(_("hg: parse error: %s\n") % inst.args[0])
83 _reportsimilar(write, similar)
83 _reportsimilar(write, similar)
84 if inst.hint:
85 write(_("(%s)\n") % inst.hint)
84
86
85 def dispatch(req):
87 def dispatch(req):
86 "run the command specified in req.args"
88 "run the command specified in req.args"
@@ -111,8 +113,6 b' def dispatch(req):'
111 return -1
113 return -1
112 except error.ParseError as inst:
114 except error.ParseError as inst:
113 _formatparse(ferr.write, inst)
115 _formatparse(ferr.write, inst)
114 if inst.hint:
115 ferr.write(_("(%s)\n") % inst.hint)
116 return -1
116 return -1
117
117
118 msg = ' '.join(' ' in a and repr(a) or a for a in req.args)
118 msg = ' '.join(' ' in a and repr(a) or a for a in req.args)
@@ -208,8 +208,6 b' def _runcatch(req):'
208 (inst.args[0], " ".join(inst.args[1])))
208 (inst.args[0], " ".join(inst.args[1])))
209 except error.ParseError as inst:
209 except error.ParseError as inst:
210 _formatparse(ui.warn, inst)
210 _formatparse(ui.warn, inst)
211 if inst.hint:
212 ui.warn(_("(%s)\n") % inst.hint)
213 return -1
211 return -1
214 except error.LockHeld as inst:
212 except error.LockHeld as inst:
215 if inst.errno == errno.ETIMEDOUT:
213 if inst.errno == errno.ETIMEDOUT:
General Comments 0
You need to be logged in to leave comments. Login now