jp (base): added msg and exit_code argument to errback so it's more generic
This commit is contained in:
parent
f12d873897
commit
f7657610f4
1 changed files with 8 additions and 3 deletions
|
|
@ -759,14 +759,19 @@ class CommandBase(object):
|
|||
raise exceptions.InternalError(_(u'trying to use output when use_output has not been set'))
|
||||
return self.host.output(output_type, self.args.output, self.extra_outputs, data)
|
||||
|
||||
def errback(self, failure_):
|
||||
def errback(self, failure_, msg=None, exit_code=C.EXIT_ERROR):
|
||||
"""generic callback for errbacks
|
||||
|
||||
display failure_ then quit with generic error
|
||||
@param failure_: arguments returned by errback
|
||||
@param msg(unicode, None): message template
|
||||
use {} if you want to display failure message
|
||||
@param exit_code(int): shell exit code
|
||||
"""
|
||||
self.disp(u"error: {}".format(failure_), error=True)
|
||||
self.host.quit(C.EXIT_ERROR)
|
||||
if msg is None:
|
||||
msg = _(u"error: {}")
|
||||
self.disp(msg.format(failure_), error=True)
|
||||
self.host.quit(exit_code)
|
||||
|
||||
def add_parser_options(self):
|
||||
try:
|
||||
|
|
|
|||
Loading…
Reference in a new issue