* more informative
This commit is contained in:
@@ -26,7 +26,7 @@ def handle_exception(exception, value, tb):
|
||||
import pisi.context as ctx
|
||||
from pisi.xmlext import XmlError
|
||||
|
||||
ui = pisi.cli.CLI()
|
||||
ui = pisi.cli.CLI() # make a temporary UI
|
||||
show_traceback = False
|
||||
if exception == exceptions.KeyboardInterrupt:
|
||||
ui.error(_("\nKeyboardInterrupt: Exiting...\n"))
|
||||
@@ -35,25 +35,26 @@ def handle_exception(exception, value, tb):
|
||||
ui.error(unicode(value))
|
||||
sys.exit(1)
|
||||
elif isinstance(value, pisi.Error):
|
||||
ui.error(_("Fatal Error"))
|
||||
ui.error(_("Fatal Error."))
|
||||
show_traceback = ctx.config.get_option('debug')
|
||||
elif isinstance(value, pisi.Exception):
|
||||
show_traceback = True
|
||||
ui.error(_("""
|
||||
Internal PISI Error:
|
||||
Please file a bug report! (http://bugs.uludag.org.tr)
|
||||
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(_("System Error."))
|
||||
|
||||
ui.error("%s: %s\n" % (exception, value))
|
||||
|
||||
if show_traceback:
|
||||
ui.info(_("Traceback:"))
|
||||
traceback.print_tb(tb)
|
||||
else:
|
||||
ui.info(_("Use --debug to see a traceback."))
|
||||
|
||||
sys.exit(1)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user