jp (base): added generic errback to CommandBase + show error message on plugin ImportError
This commit is contained in:
parent
7c58313ed0
commit
90824a69b0
1 changed files with 13 additions and 2 deletions
|
|
@ -332,8 +332,10 @@ class Jp(object):
|
|||
try:
|
||||
module = import_module(module_path)
|
||||
self.import_plugin_module(module, type_)
|
||||
except ImportError:
|
||||
log.warning(_(u"Can't import {} plugin, ignoring it".format(module_path)))
|
||||
except ImportError as e:
|
||||
log.warning(_(u"Can't import {module_path} plugin, ignoring it: {msg}".format(
|
||||
module_path = module_path,
|
||||
msg = e)))
|
||||
except exceptions.CancelError:
|
||||
continue
|
||||
except exceptions.MissingModule as e:
|
||||
|
|
@ -724,6 +726,15 @@ class CommandBase(object):
|
|||
def output(self, data):
|
||||
return self.host.output(self._output_type, self.args.output, self.extra_outputs, data)
|
||||
|
||||
def errback(self, failure_):
|
||||
"""generic callback for errbacks
|
||||
|
||||
display failure_ then quit with generic error
|
||||
@param failure_: arguments returned by errback
|
||||
"""
|
||||
self.disp(u"error: {}".format(failure_), error=True)
|
||||
self.host.quit(C.EXIT_ERROR)
|
||||
|
||||
def add_parser_options(self):
|
||||
try:
|
||||
subcommands = self.subcommands
|
||||
|
|
|
|||
Loading…
Reference in a new issue