wmedvede commented on code in PR #4014:
URL:
https://github.com/apache/incubator-kie-kogito-runtimes/pull/4014#discussion_r2259317095
##########
kogito-serverless-workflow/kogito-serverless-workflow-rest-runtime/src/main/java/org/kie/kogito/serverless/workflow/rest/JsonNodeResultHandler.java:
##########
@@ -30,11 +31,18 @@
import static
org.kogito.workitem.rest.RestWorkItemHandlerUtils.checkStatusCode;
public class JsonNodeResultHandler implements RestWorkItemHandlerResult {
+
+ static final String STATUS_CODE = "statusCode";
+ static final String STATUS_MESSAGE = "statusMessage";
+
@Override
public Object apply(HttpResponse<Buffer> t, Class<?> u,
KogitoProcessContext context) {
Map<String, Object> metadata =
context.getNodeInstance().getNode().getMetaData();
if (metadata == null ||
toBoolean(metadata.getOrDefault("failOnStatusCode", Boolean.TRUE))) {
checkStatusCode(t);
+ } else {
+ context.setVariable(STATUS_CODE, t.statusCode());
Review Comment:
Ok, if we configure explicitly failOnStatusCode == false, we propagate the
code and continue.
see comment below
##########
quarkus/extensions/kogito-quarkus-serverless-workflow-extension/kogito-quarkus-serverless-workflow-integration-test/src/main/resources/errorIgnoring.sw.json:
##########
@@ -100,25 +95,32 @@
"functionRef" : {
"refName": "publishPerfectSquare",
"arguments": {
- "type": "$.numberType",
- "number": "$.number"
+ "type": ".numberType",
+ "number": ".number"
}
}
}
],
- "end": true,
- "onErrors": [
- {
- "errorRef": "bad request",
- "transition": "setError"
- }
- ]
+ "transition" : "customErrorHandling"
+ },
+ {
+ "name": "customErrorHandling",
+ "type": "switch",
+ "dataConditions": [
+ {
+ "condition": "$WORKFLOW.statusCode == 400",
Review Comment:
This WF doesn't have the failOnStatusCode == false configured, will the
$WORKFLOW.statusCode still be propagated?
--
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]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]