Error result: doc explaining error result in base action class

Change-Id: I59da6788f2df46ee3346957832bc0082dfbccd7c
This commit is contained in:
Renat Akhmerov 2015-07-15 18:24:51 +06:00
parent 84c6df1ac5
commit 7ca5f168e4

View File

@ -47,12 +47,21 @@ class Action(object):
def run(self):
"""Run action logic.
:return: result of the action. Note that for asynchronous actions
:return: Result of the action. Note that for asynchronous actions
it should always be None, however, if even it's not None it will be
ignored by a caller.
In case if action failed this method must throw a ActionException
to indicate that.
Result can be of two types:
1) Any serializable value meaningful from a user perspective (such
as string, number or dict).
2) Instance of {mistral.workflow.utils.Result} which has field "data"
for success result and field "error" for keeping so called "error
result" like HTTP error code and similar. Using the second type
allows to communicate a result even in case of error and hence to have
conditions in "on-error" clause of direct workflows. Depending on
particular action semantics one or another option may be preferable.
In case if action failed and there's no need to communicate any error
result this method should throw a ActionException.
"""
pass