Error trapping oddness in 7.4

Posted on
Thu Dec 05, 2019 9:07 am
kmarkley offline
Posts: 185
Joined: Nov 15, 2016

Error trapping oddness in 7.4

Since upgrading to 7.4 a couple days ago, I can no longer trap errors from calling non-existent Action Groups.

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.

Posted on
Thu Dec 05, 2019 9:30 am
matt (support) offline
Site Admin
User avatar
Posts: 21417
Joined: Jan 27, 2003
Location: Texas

Re: Error trapping oddness in 7.4

We'll look into this. If it changed it wasn't intentional – it should throw an exception.

Image

Posted on
Fri Feb 07, 2020 2:18 pm
matt (support) offline
Site Admin
User avatar
Posts: 21417
Joined: Jan 27, 2003
Location: Texas

Re: Error trapping oddness in 7.4

Indigo 7.4.1 is now available and will again throw exceptions if the elem is not found.

Image

Page 1 of 1

Who is online

Users browsing this forum: No registered users and 4 guests

cron