mirror of
https://github.com/deadc0de6/dotdrop.git
synced 2026-02-10 22:34:18 +00:00
give action errors more context
This commit is contained in:
@@ -36,7 +36,7 @@ class Cmd(DictParser):
|
|||||||
try:
|
try:
|
||||||
action = templater.generate_string(self.action)
|
action = templater.generate_string(self.action)
|
||||||
except UndefinedException as e:
|
except UndefinedException as e:
|
||||||
err = 'bad {}: {}'.format(self.descr, e)
|
err = 'undefined variable for {}: \"{}\"'.format(self.descr, e)
|
||||||
self.log.warn(err)
|
self.log.warn(err)
|
||||||
return False
|
return False
|
||||||
if debug:
|
if debug:
|
||||||
@@ -51,8 +51,8 @@ class Cmd(DictParser):
|
|||||||
try:
|
try:
|
||||||
args = [templater.generate_string(a) for a in args]
|
args = [templater.generate_string(a) for a in args]
|
||||||
except UndefinedException as e:
|
except UndefinedException as e:
|
||||||
err = 'bad arguments for {}: {}'.format(self.descr, e)
|
err = 'undefined arguments for {}: {}'
|
||||||
self.log.warn(err)
|
self.log.warn(err.format(self.descr, e))
|
||||||
return False
|
return False
|
||||||
if debug and args:
|
if debug and args:
|
||||||
self.log.dbg('action args:')
|
self.log.dbg('action args:')
|
||||||
@@ -60,13 +60,14 @@ class Cmd(DictParser):
|
|||||||
self.log.dbg('\targs[{}]: {}'.format(cnt, arg))
|
self.log.dbg('\targs[{}]: {}'.format(cnt, arg))
|
||||||
try:
|
try:
|
||||||
cmd = action.format(*args)
|
cmd = action.format(*args)
|
||||||
except IndexError:
|
except IndexError as e:
|
||||||
err = 'bad {}: \"{}\"'.format(self.descr, action)
|
err = 'index error for {}: \"{}\"'.format(self.descr, action)
|
||||||
err += ' with \"{}\"'.format(args)
|
err += ' with \"{}\"'.format(args)
|
||||||
|
err += ': {}'.format(e)
|
||||||
self.log.warn(err)
|
self.log.warn(err)
|
||||||
return False
|
return False
|
||||||
except KeyError:
|
except KeyError as e:
|
||||||
err = 'bad {}: \"{}\"'.format(self.descr, action)
|
err = 'key error for {}: \"{}\": {}'.format(self.descr, action, e)
|
||||||
err += ' with \"{}\"'.format(args)
|
err += ' with \"{}\"'.format(args)
|
||||||
self.log.warn(err)
|
self.log.warn(err)
|
||||||
return False
|
return False
|
||||||
|
|||||||
Reference in New Issue
Block a user