* fix long standing bug about ascertaining the type of exception,

We should've used a proper try catch block instead of this stuff.
Going to change it in the first opportunity.
* This was the sensible thing to do, but it didn't work before.
This commit is contained in:
Eray Özkural
2005-10-11 23:24:01 +00:00
parent b2564e3a4d
commit d2d39345fd
+14 -14
View File
@@ -32,26 +32,26 @@ def handle_exception(exception, value, tb):
ui.error(_("\nKeyboardInterrupt: Exiting...\n")) ui.error(_("\nKeyboardInterrupt: Exiting...\n"))
sys.exit(1) sys.exit(1)
elif exception == XmlError: elif exception == XmlError:
ui.error(str(value)) ui.error(unicode(value))
sys.exit(1) sys.exit(1)
elif exception == pisi.Error: elif isinstance(value, pisi.Error):
ui.error(_("Fatal Error:")) ui.error(_("Fatal Error"))
show_traceback = ctx.options and ctx.options.debug show_traceback = ctx.config.get_option('debug')
elif exception == pisi.Exception: elif isinstance(value, pisi.Exception):
show_traceback = True show_traceback = True
else:
# For any other exception (possibly Python exceptions) show
# the traceback!
show_traceback = True
ui.error("%s" %exception)
ui.error("%s\n" %value)
if show_traceback:
ui.error(_(""" ui.error(_("""
Internal PISI Error: Internal PISI Error:
Please file a bug report! (http://bugs.uludag.org.tr) Please file a bug report! (http://bugs.uludag.org.tr)
""")) """))
else:
# For any other exception (possibly Python exceptions) show
# the traceback!
show_traceback = ctx.config.get_option('debug')
ui.error("System Error. Use --debug to see a traceback.")
ui.error("%s: %s\n" % (exception, value))
if show_traceback:
ui.info(_("Traceback:")) ui.info(_("Traceback:"))
traceback.print_tb(tb) traceback.print_tb(tb)