No critical on nonexisting message_played

This commit is contained in:
Ruben van de Ven 2019-11-12 14:22:08 +01:00
parent 76d440fd8f
commit f15126d0e4
3 changed files with 9 additions and 1 deletions

View file

@ -359,6 +359,7 @@ class CentralCommand(object):
# stop if False, ie. when stream has gone # stop if False, ie. when stream has gone
return return
#TODO: hugveyid in log and prevent duplicate messages
logger.critical(f'Hugvey stopped (crashed?). Reinstantiate after 5 sec') logger.critical(f'Hugvey stopped (crashed?). Reinstantiate after 5 sec')
time.sleep(5) time.sleep(5)

View file

@ -485,7 +485,9 @@ class Condition(object):
msgId = self.vars['msgId'].strip() msgId = self.vars['msgId'].strip()
msg = story.get(msgId) msg = story.get(msgId)
if not msg: if not msg:
story.logger.critical(f"Condition on non-existing message: {msgId}") if not self.logInfo:
# show error only once
story.logger.warning(f"Condition on non-existing message: {msgId}")
# assigning false to r, keeps 'inverseMatch' working, even when msgId is wrong # assigning false to r, keeps 'inverseMatch' working, even when msgId is wrong
r = False r = False
else: else:

View file

@ -148,6 +148,11 @@ class Toolbox:
logger.info(f"Direction pointed to {item['source']}") logger.info(f"Direction pointed to {item['source']}")
logger.info(f"Will now point to {validMsg}") logger.info(f"Will now point to {validMsg}")
item['source'] = item['source']['@id'] item['source'] = item['source']['@id']
if item['@type'] == 'Condition':
if item['type'] == 'messagePlayed':
msgId = item['vars']['msgId'].strip()
if msgId not in itemsPerId:
logger.critical(f"Message played condition for non-existing message {msgId}!")
with open(filename, 'w') as fp: with open(filename, 'w') as fp:
json.dump(story, fp, indent=2) json.dump(story, fp, indent=2)