[issue21] cannot debug extension
The following patch should work.
--- a/mercurial/commands.py Mon Oct 24 14:52:49 2005 -0700
+++ b/mercurial/commands.py Mon Oct 24 14:53:12 2005 -0700
@@ -2068,11 +2068,16 @@
u = ui.ui()
external = []
for x in u.extensions():
+ def on_exception(Exception, inst):
+ u.warn(_("*** failed to import extension %s\n") % x[1])
+ u.warn("%s\n" % inst)
+ if "--traceback" in sys.argv[1:]:
+ traceback.print_exc()
if x[1]:
try:
mod = imp.load_source(x[0], x[1])
- except:
- u.warn(_("*** failed to import extension %s\n") % x[1])
+ except Exception, inst:
+ on_exception(Exception, inst)
continue
else:
def importh(name):
@@ -2083,8 +2088,8 @@
return mod
try:
mod = importh(x[0])
- except:
- u.warn(_("failed to import extension %s\n") % x[0])
+ except Exception, inst:
+ on_exception(Exception, inst)
continue
external.append(mod)