I have a plugin that includes this code block:
- Code: Select all
for action in self.actionList:
try:
indigo.actionGroup.execute(action)
self.logger.debug(u'{}{:<{}}: executed'.format(indent,action,pad))
self.sleep(self.plugin.actionSleep)
except Exception as e:
if isinstance(e, ValueError) and e.message.startswith('ElementNotFoundError'):
if self.plugin.logMissing:
self.logger.info(u'{:<{}}: missing'.format(action,pad))
else:
self.logger.debug(u' {:<{}}: missing'.format(action,pad))
else:
self.logger.error(u'{}: action group execute error \n{}'.format(self.name, e))
Before the upgrade this worked as expected. If the plugin tried to execute a non-existent Action Group, an error would be raised and the except block executed.
Since upgrading, Indigo prints an error to the event log but the rest of the try block runs instead of the except block:
- Code: Select all
Error ElementNotFoundError -- could not find action group "Fake Group"
It's like a python error does not actually get raised from the indigo.actionGroup.execute() command.
I see the same behavior when I test this in the scripting shell:
- Code: Select all
>>> indigo.actionGroup.execute("Fake Group")
>>>
So two questions:
1. Has Indigo changed how is raises errors in indigo.actionGroup.execute() (and possibly elsewhere)?
2. What's the best way to ask Indigo if an Action Group exists before attempting to execute it? indigo.actionGroups["Fake Group"] does seem the raise an error, but I'm no longer confident that error trapping is the best approach.
Thanks.