From d2d39345fd035de65c3a718e7282323e1cd89d23 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Eray=20=C3=96zkural?= Date: Tue, 11 Oct 2005 23:24:01 +0000 Subject: [PATCH] * 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. --- pisi-cli | 28 ++++++++++++++-------------- 1 file changed, 14 insertions(+), 14 deletions(-) diff --git a/pisi-cli b/pisi-cli index 647d318f..3999dad3 100755 --- a/pisi-cli +++ b/pisi-cli @@ -32,26 +32,26 @@ def handle_exception(exception, value, tb): ui.error(_("\nKeyboardInterrupt: Exiting...\n")) sys.exit(1) elif exception == XmlError: - ui.error(str(value)) + ui.error(unicode(value)) sys.exit(1) - elif exception == pisi.Error: - ui.error(_("Fatal Error:")) - show_traceback = ctx.options and ctx.options.debug - elif exception == pisi.Exception: + elif isinstance(value, pisi.Error): + ui.error(_("Fatal Error")) + show_traceback = ctx.config.get_option('debug') + elif isinstance(value, pisi.Exception): 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(_(""" Internal PISI Error: 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:")) traceback.print_tb(tb)