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