ningyougang commented on code in PR #5290:
URL: https://github.com/apache/openwhisk/pull/5290#discussion_r929691941
##########
core/controller/src/main/scala/org/apache/openwhisk/core/controller/actions/SequenceActions.scala:
##########
@@ -460,9 +465,10 @@ protected[actions] case class
SequenceAccounting(atomicActionCnt: Int,
// check conditions on payload that may lead to interrupting the execution
of the sequence
// short-circuit the execution of the sequence iff the payload
contains an error field
// and is the result of an action return, not the initial payload
- val outputPayload = activation.response.result.map(_.asJsObject)
- val payloadContent = outputPayload getOrElse JsObject.empty
- val errorField = payloadContent.fields.get(ActivationResponse.ERROR_FIELD)
+ val errorField: Option[JsValue] = activation.response.result match {
+ case Some(JsObject(fields)) => fields.get(ActivationResponse.ERROR_FIELD)
+ case _ => None
Review Comment:
* So users can't define the explicit error response when the result is a
JSON array.
Yes, can't define the explicit error response for a JSON array,
but if we want to define the explicit error response, normally, user should
return the JSON-object result.
* But there would be no difference in the JSON-object-based action, right?
For the JSON-object-based action, have no any bad influences on these
actions, have no any change.
* Regarding
```
Sometimes, libraries return an error filed and OW considers that as an error
of an action as well.
Since there would be no behavioral difference in the JSON-object-based
actions, there would be no difference in existing semantics, right?
```
I am not sure whether i understand correctly, if libraries return an `error`
or user's codes has some error, normally, there would has `catch(....)`
statement in user's code, and in catch statement, user can return the error or
some excetion error with JSON-object result.
If user codes run well without any error or exception, can return array
result finally.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]