##// END OF EJS Templates
add ui.print_exc(), make all traceback printing central.
Vadim Gelfer -
r2335:f0680b2d default
parent child Browse files
Show More
@@ -3299,10 +3299,8 b' def dispatch(args):'
3299 3299 external.append(mod)
3300 3300 except Exception, inst:
3301 3301 u.warn(_("*** failed to import extension %s: %s\n") % (x[0], inst))
3302 if u.traceback:
3303 traceback.print_exc()
3302 if u.print_exc():
3304 3303 return 1
3305 continue
3306 3304
3307 3305 for x in external:
3308 3306 uisetup = getattr(x, 'uisetup', None)
@@ -3398,8 +3396,7 b' def dispatch(args):'
3398 3396 # enter the debugger when we hit an exception
3399 3397 if options['debugger']:
3400 3398 pdb.post_mortem(sys.exc_info()[2])
3401 if u.traceback:
3402 traceback.print_exc()
3399 u.print_exc()
3403 3400 raise
3404 3401 except ParseError, inst:
3405 3402 if inst.args[0]:
@@ -12,7 +12,7 b' from i18n import gettext as _'
12 12 from demandload import *
13 13 demandload(globals(), "appendfile changegroup")
14 14 demandload(globals(), "re lock transaction tempfile stat mdiff errno ui")
15 demandload(globals(), "revlog traceback")
15 demandload(globals(), "revlog")
16 16
17 17 class localrepository(object):
18 18 def __del__(self):
@@ -125,8 +125,7 b' class localrepository(object):'
125 125 '%s\n') % (hname, exc))
126 126 if throw:
127 127 raise
128 if self.ui.traceback:
129 traceback.print_exc()
128 self.ui.print_exc()
130 129 return True
131 130 if r:
132 131 if throw:
@@ -9,7 +9,7 b' import ConfigParser'
9 9 from i18n import gettext as _
10 10 from demandload import *
11 11 demandload(globals(), "errno getpass os re smtplib socket sys tempfile")
12 demandload(globals(), "templater util")
12 demandload(globals(), "templater traceback util")
13 13
14 14 class ui(object):
15 15 def __init__(self, verbose=False, debug=False, quiet=False,
@@ -335,3 +335,11 b' class ui(object):'
335 335 else:
336 336 mail = sendmail(self, method)
337 337 return mail
338
339 def print_exc(self):
340 '''print exception traceback if traceback printing enabled.
341 only to call in exception handler. returns true if traceback
342 printed.'''
343 if self.traceback:
344 traceback.print_exc()
345 return self.traceback
General Comments 0
You need to be logged in to leave comments. Login now