Print human readable error messages. We must use str instead of unicode in order to use __str__ method of exception classes.

This commit is contained in:
Fatih Aşıcı
2010-02-27 21:32:58 +00:00
parent dbb9a91cd9
commit fcf0669476
+7 -7
View File
@@ -41,24 +41,24 @@ def handle_exception(exception, value, tb):
ui.error(_("Keyboard Interrupt: Exiting..."))
exit()
elif isinstance(value, pisi.Error):
ui.error(_("Program Terminated."))
ui.error(_("Program terminated."))
show_traceback = ctx.get_option('debug')
elif isinstance(value, pisi.Exception):
show_traceback = True
ui.error(_("""Unhandled internal exception.
Please file a bug report. (http://bugs.pardus.org.tr)"""))
ui.error(_("Unhandled internal exception.\n"
"Please file a bug report to <http://bugs.pardus.org.tr>"))
else:
# For any other exception (possibly Python exceptions) show
# the traceback!
show_traceback = ctx.get_option('debug')
ui.error(_("System Error. Program Terminated."))
ui.error(_("System error. Program terminated."))
if ctx.get_option('debug'):
ui.error(u"%s: %s" % (exception, value))
ui.error(u"%s: %s" % (exception, str(value)))
else:
ui.error(unicode(value))
ui.error(str(value))
ui.info(_("Please use 'pisi help' for general help."))
ui.info(_("\nPlease use 'pisi help' for general help."))
if show_traceback:
ui.info(_("Traceback:"))