fjtirado commented on code in PR #4076:
URL:
https://github.com/apache/incubator-kie-kogito-runtimes/pull/4076#discussion_r2401708872
##########
quarkus/extensions/kogito-quarkus-serverless-workflow-extension/kogito-quarkus-serverless-workflow/src/main/java/org/kie/kogito/serverless/workflow/openapi/OpenApiWorkItemHandler.java:
##########
@@ -69,14 +78,29 @@ public void filter(ClientRequestContext requestContext)
throws IOException {
});
}
}
- }, Integer.MIN_VALUE).build(clazz);
+ }, Integer.MIN_VALUE).register((ResponseExceptionMapper) response ->
new WebApplicationException(fromResponse(response),
response.getStatus())).build(clazz);
try {
return internalExecute(ref, parameters);
} catch (WebApplicationException ex) {
throw new
WorkItemExecutionException(Integer.toString(ex.getResponse().getStatus()),
ex.getMessage());
}
}
+ private String fromResponse(Response response) {
+ Object entity = response.getEntity();
+ if (entity instanceof ByteArrayInputStream input) {
+ if
(MediaType.APPLICATION_JSON_TYPE.equals(response.getMediaType())) {
+ try {
+ return
ObjectMapperFactory.get().readTree(input).toString();
+ } catch (IOException e) {
+ logger.warn("Error parsing json error response {}",
e.toString());
Review Comment:
Took into account that this will appear only if the operation has failed, so
I feel it might provoke confusion during analysis of the trace if another long
stack trace appear.
Also, since this will be a jackson exception, probably the message will be
enough to find out why the json cannot be parsed
--
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]