Mercurial > public > mercurial-scm > hg-stable
comparison mercurial/dispatch.py @ 16705:c2d9ef43ff6c
check-code: ignore naked excepts with a "re-raise" comment
This also promotes the naked except check from a warning to an error.
author | Brodie Rao <brodie@sf.io> |
---|---|
date | Sun, 13 May 2012 13:18:06 +0200 |
parents | 67964cda8701 |
children | 1c9f58a6c8f1 |
comparison
equal
deleted
inserted
replaced
16704:1f3acc30bdfe | 16705:c2d9ef43ff6c |
---|---|
86 pdb.set_trace() | 86 pdb.set_trace() |
87 try: | 87 try: |
88 return _dispatch(req) | 88 return _dispatch(req) |
89 finally: | 89 finally: |
90 ui.flush() | 90 ui.flush() |
91 except: | 91 except: # re-raises |
92 # enter the debugger when we hit an exception | 92 # enter the debugger when we hit an exception |
93 if '--debugger' in req.args: | 93 if '--debugger' in req.args: |
94 traceback.print_exc() | 94 traceback.print_exc() |
95 pdb.post_mortem(sys.exc_info()[2]) | 95 pdb.post_mortem(sys.exc_info()[2]) |
96 ui.traceback() | 96 ui.traceback() |
202 # Commands shouldn't sys.exit directly, but give a return code. | 202 # Commands shouldn't sys.exit directly, but give a return code. |
203 # Just in case catch this and and pass exit code to caller. | 203 # Just in case catch this and and pass exit code to caller. |
204 return inst.code | 204 return inst.code |
205 except socket.error, inst: | 205 except socket.error, inst: |
206 ui.warn(_("abort: %s\n") % inst.args[-1]) | 206 ui.warn(_("abort: %s\n") % inst.args[-1]) |
207 except: | 207 except: # re-raises |
208 ui.warn(_("** unknown exception encountered," | 208 ui.warn(_("** unknown exception encountered," |
209 " please report by visiting\n")) | 209 " please report by visiting\n")) |
210 ui.warn(_("** http://mercurial.selenic.com/wiki/BugTracker\n")) | 210 ui.warn(_("** http://mercurial.selenic.com/wiki/BugTracker\n")) |
211 ui.warn(_("** Python %s\n") % sys.version.replace('\n', '')) | 211 ui.warn(_("** Python %s\n") % sys.version.replace('\n', '')) |
212 ui.warn(_("** Mercurial Distributed SCM (version %s)\n") | 212 ui.warn(_("** Mercurial Distributed SCM (version %s)\n") |