Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix error handling within iterator #362

Open
wants to merge 4 commits into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 8 additions & 4 deletions pyblish_qml/control.py
Original file line number Diff line number Diff line change
Expand Up @@ -353,11 +353,13 @@ def iterator(self, plugins, context):
signals.pop(order).emit()

if not self.data["state"]["is_running"]:
return StopIteration("Stopped")
yield StopIteration("Stopped")
return
buddly27 marked this conversation as resolved.
Show resolved Hide resolved

if test(**state):
self.data["state"]["testPassed"] = False
return StopIteration("Stopped due to %s" % test(**state))
yield StopIteration("Stopped due to %s" % test(**state))
return

self.data["state"]["testPassed"] = True

Expand All @@ -368,7 +370,8 @@ def iterator(self, plugins, context):
result = self.host.process(plug, context, instance)

except Exception as e:
return StopIteration("Unknown error: %s" % e)
yield StopIteration("Unknown error: %s" % e)
return

else:
# Make note of the order at which the
Expand Down Expand Up @@ -1207,7 +1210,8 @@ def iterator(plugins, context):

message = test(**state)
if message:
return StopIteration("Stopped due to %s" % message)
yield StopIteration("Stopped due to %s" % message)
return

instances = pyblish.api.instances_by_plugin(context, plugin)
if plugin.__instanceEnabled__:
Expand Down