Open NavidMitchell opened 4 months ago
The service invoker does not return the error if a method that returns a CompletableFuture encounters an unhandled exception and never completes the future.
I saw this when the code below tried to deserialize the json and failed.
org.kinotic.structures.internal.api.services.sql.DefaultElasticVertxClient Line: 61
public CompletableFuture<TranslateResponse> translateSql(String statement, List<?> params){ VertxCompletableFuture<TranslateResponse> responseFuture = new VertxCompletableFuture<>(vertx); JsonObject json = new JsonObject().put("query", statement); if(params != null) { JsonArray paramsJson = new JsonArray(); for(Object param : params){ paramsJson.add(param); } json.put("params", paramsJson); } sqlTranslateRequest.sendJsonObject(json, ar -> { if(ar.succeeded()){ TranslateResponse translateResponse = TranslateResponse.of(builder -> { builder.withJson(new ByteArrayInputStream(ar.result() .body() .getBytes())); return builder; }); responseFuture.complete(translateResponse); }else{ responseFuture.completeExceptionally(ar.cause()); } }); return responseFuture; }
This appears to be happening since the TranslateResponse.of code is running on a different thread than the service invocation.
The service invoker does not return the error if a method that returns a CompletableFuture encounters an unhandled exception and never completes the future.
I saw this when the code below tried to deserialize the json and failed.
org.kinotic.structures.internal.api.services.sql.DefaultElasticVertxClient Line: 61