##// END OF EJS Templates
dispatch: split global error handling out so it can be reused...
Jun Wu -
r29761:39149b60 default
parent child Browse files
Show More
@@ -150,7 +150,7 b' def _runcatch(req):'
150 150 except ValueError:
151 151 pass # happens if called in a thread
152 152
153 try:
153 def _runcatchfunc():
154 154 try:
155 155 debugger = 'pdb'
156 156 debugtrace = {
@@ -212,6 +212,16 b' def _runcatch(req):'
212 212 ui.traceback()
213 213 raise
214 214
215 return callcatch(ui, _runcatchfunc)
216
217 def callcatch(ui, func):
218 """call func() with global exception handling
219
220 return func() if no exception happens. otherwise do some error handling
221 and return an exit code accordingly.
222 """
223 try:
224 return func()
215 225 # Global exception handling, alphabetically
216 226 # Mercurial-specific first, followed by built-in and library exceptions
217 227 except error.AmbiguousCommand as inst:
@@ -91,6 +91,8 b''
91 91 */mercurial/dispatch.py:* in run (glob)
92 92 */mercurial/dispatch.py:* in dispatch (glob)
93 93 */mercurial/dispatch.py:* in _runcatch (glob)
94 */mercurial/dispatch.py:* in callcatch (glob)
95 */mercurial/dispatch.py:* in _runcatchfunc (glob)
94 96 */mercurial/dispatch.py:* in _dispatch (glob)
95 97 */mercurial/dispatch.py:* in runcommand (glob)
96 98 */mercurial/dispatch.py:* in _runcommand (glob)
@@ -125,6 +127,8 b''
125 127 */mercurial/dispatch.py:* in run (glob)
126 128 */mercurial/dispatch.py:* in dispatch (glob)
127 129 */mercurial/dispatch.py:* in _runcatch (glob)
130 */mercurial/dispatch.py:* in callcatch (glob)
131 */mercurial/dispatch.py:* in _runcatchfunc (glob)
128 132 */mercurial/dispatch.py:* in _dispatch (glob)
129 133 */mercurial/dispatch.py:* in runcommand (glob)
130 134 */mercurial/dispatch.py:* in _runcommand (glob)
@@ -147,6 +151,8 b''
147 151 */mercurial/dispatch.py:* in run (glob)
148 152 */mercurial/dispatch.py:* in dispatch (glob)
149 153 */mercurial/dispatch.py:* in _runcatch (glob)
154 */mercurial/dispatch.py:* in callcatch (glob)
155 */mercurial/dispatch.py:* in _runcatchfunc (glob)
150 156 */mercurial/dispatch.py:* in _dispatch (glob)
151 157 */mercurial/dispatch.py:* in runcommand (glob)
152 158 */mercurial/dispatch.py:* in _runcommand (glob)
General Comments 0
You need to be logged in to leave comments. Login now