##// END OF EJS Templates
errors: format "abort: " text in a new Abort.format() method...
Martin von Zweigbergk -
r46497:600aec73 default
parent child Browse files
Show More
@@ -512,9 +512,7 b' class chgcmdserver(commandserver.server)'
512 self.cresult.write(b'exit 255')
512 self.cresult.write(b'exit 255')
513 return
513 return
514 except error.Abort as inst:
514 except error.Abort as inst:
515 self.ui.error(_(b"abort: %s\n") % inst.message)
515 self.ui.error(inst.format())
516 if inst.hint:
517 self.ui.error(_(b"(%s)\n") % inst.hint)
518 self.ui.flush()
516 self.ui.flush()
519 self.cresult.write(b'exit 255')
517 self.cresult.write(b'exit 255')
520 return
518 return
@@ -256,9 +256,7 b' def dispatch(req):'
256 if req.fmsg:
256 if req.fmsg:
257 req.ui.fmsg = req.fmsg
257 req.ui.fmsg = req.fmsg
258 except error.Abort as inst:
258 except error.Abort as inst:
259 ferr.write(_(b"abort: %s\n") % inst.message)
259 ferr.write(inst.format())
260 if inst.hint:
261 ferr.write(_(b"(%s)\n") % inst.hint)
262 return -1
260 return -1
263 except error.ParseError as inst:
261 except error.ParseError as inst:
264 ferr.write(inst.format())
262 ferr.write(inst.format())
@@ -182,6 +182,14 b' class Abort(Hint, Exception):'
182 # may raise another exception.
182 # may raise another exception.
183 return pycompat.sysstr(self.__bytes__())
183 return pycompat.sysstr(self.__bytes__())
184
184
185 def format(self):
186 from .i18n import _
187
188 message = _(b"abort: %s\n") % self.message
189 if self.hint:
190 message += _(b"(%s)\n") % self.hint
191 return message
192
185
193
186 class InputError(Abort):
194 class InputError(Abort):
187 """Indicates that the user made an error in their input.
195 """Indicates that the user made an error in their input.
@@ -230,9 +230,7 b' def callcatch(ui, func):'
230 detailed_exit_code = 30
230 detailed_exit_code = 30
231 elif isinstance(inst, error.CanceledError):
231 elif isinstance(inst, error.CanceledError):
232 detailed_exit_code = 250
232 detailed_exit_code = 250
233 ui.error(_(b"abort: %s\n") % inst.message)
233 ui.error(inst.format())
234 if inst.hint:
235 ui.error(_(b"(%s)\n") % inst.hint)
236 except error.WorkerError as inst:
234 except error.WorkerError as inst:
237 # Don't print a message -- the worker already should have
235 # Don't print a message -- the worker already should have
238 return inst.status_code
236 return inst.status_code
@@ -685,9 +685,7 b' def unbundle(repo, proto, heads):'
685 # We did not change it to minimise code change.
685 # We did not change it to minimise code change.
686 # This need to be moved to something proper.
686 # This need to be moved to something proper.
687 # Feel free to do it.
687 # Feel free to do it.
688 procutil.stderr.write(b"abort: %s\n" % exc.message)
688 procutil.stderr.write(exc.format())
689 if exc.hint is not None:
690 procutil.stderr.write(b"(%s)\n" % exc.hint)
691 procutil.stderr.flush()
689 procutil.stderr.flush()
692 return wireprototypes.pushres(
690 return wireprototypes.pushres(
693 0, output.getvalue() if output else b''
691 0, output.getvalue() if output else b''
General Comments 0
You need to be logged in to leave comments. Login now