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:
@@ -41,24 +41,24 @@ def handle_exception(exception, value, tb):
|
|||||||
ui.error(_("Keyboard Interrupt: Exiting..."))
|
ui.error(_("Keyboard Interrupt: Exiting..."))
|
||||||
exit()
|
exit()
|
||||||
elif isinstance(value, pisi.Error):
|
elif isinstance(value, pisi.Error):
|
||||||
ui.error(_("Program Terminated."))
|
ui.error(_("Program terminated."))
|
||||||
show_traceback = ctx.get_option('debug')
|
show_traceback = ctx.get_option('debug')
|
||||||
elif isinstance(value, pisi.Exception):
|
elif isinstance(value, pisi.Exception):
|
||||||
show_traceback = True
|
show_traceback = True
|
||||||
ui.error(_("""Unhandled internal exception.
|
ui.error(_("Unhandled internal exception.\n"
|
||||||
Please file a bug report. (http://bugs.pardus.org.tr)"""))
|
"Please file a bug report to <http://bugs.pardus.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.get_option('debug')
|
show_traceback = ctx.get_option('debug')
|
||||||
ui.error(_("System Error. Program Terminated."))
|
ui.error(_("System error. Program terminated."))
|
||||||
|
|
||||||
if ctx.get_option('debug'):
|
if ctx.get_option('debug'):
|
||||||
ui.error(u"%s: %s" % (exception, value))
|
ui.error(u"%s: %s" % (exception, str(value)))
|
||||||
else:
|
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:
|
if show_traceback:
|
||||||
ui.info(_("Traceback:"))
|
ui.info(_("Traceback:"))
|
||||||
|
|||||||
Reference in New Issue
Block a user