210 starttime = util.timer() |
210 starttime = util.timer() |
211 ret = 1 # default of Python exit code on unhandled exception |
211 ret = 1 # default of Python exit code on unhandled exception |
212 try: |
212 try: |
213 ret = _runcatch(req) or 0 |
213 ret = _runcatch(req) or 0 |
214 except error.ProgrammingError as inst: |
214 except error.ProgrammingError as inst: |
215 req.ui.warn(_('** ProgrammingError: %s\n') % inst) |
215 req.ui.error(_('** ProgrammingError: %s\n') % inst) |
216 if inst.hint: |
216 if inst.hint: |
217 req.ui.warn(_('** (%s)\n') % inst.hint) |
217 req.ui.error(_('** (%s)\n') % inst.hint) |
218 raise |
218 raise |
219 except KeyboardInterrupt as inst: |
219 except KeyboardInterrupt as inst: |
220 try: |
220 try: |
221 if isinstance(inst, error.SignalInterrupt): |
221 if isinstance(inst, error.SignalInterrupt): |
222 msg = _("killed!\n") |
222 msg = _("killed!\n") |
223 else: |
223 else: |
224 msg = _("interrupted!\n") |
224 msg = _("interrupted!\n") |
225 req.ui.warn(msg) |
225 req.ui.error(msg) |
226 except error.SignalInterrupt: |
226 except error.SignalInterrupt: |
227 # maybe pager would quit without consuming all the output, and |
227 # maybe pager would quit without consuming all the output, and |
228 # SIGPIPE was raised. we cannot print anything in this case. |
228 # SIGPIPE was raised. we cannot print anything in this case. |
229 pass |
229 pass |
230 except IOError as inst: |
230 except IOError as inst: |