def _HandleRunPluginException(self, ui_renderer, e):
"""Handle all exceptions thrown by logging to the console."""
if isinstance(e, plugin.InvalidArgs):
self.logging.fatal("Invalid Args: %s" % e)
elif isinstance(e, plugin.PluginError):
self.logging.fatal(str(e))
elif isinstance(e, KeyboardInterrupt) or isinstance(e, plugin.Abort):
logging.error("Aborted\r\n")
else:
error_status = traceback.format_exc()
# Report the error to the renderer.
self.logging.fatal(error_status)
# If anything goes wrong, we break into a debugger here.
if self.GetParameter("debug"):
pdb.post_mortem(sys.exc_info()[2])
# This method is called from the exception handler - this bare raise
# will preserve backtraces.
raise # pylint: disable=misplaced-bare-raise
评论列表
文章目录