You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
How to throw exception if one of the operations faile
Try<CompletableFuture<Boolean>, IOException> request = Try.withCatch(() -> Convertor.fromJsonToPojo(payload, PepRequest.class))
.onFail(e -> LOG.error("failed to serialize Json payload:{} exception:{}",payload, e))
.map(pepReq -> (new PdpRequest()).copyFromParameters(pepReq, user.getUsername()))
.onFail(e -> LOG.error("failed to create pdp request model because of the following reason:{}",e))
.flatMap(pdpRequest -> Try.withCatch(() -> new ObjectMapper().writeValueAsString(pdpRequest)))
.onFail(e -> LOG.error("failed to convert pdp request to json reason:{}",e.getMessage()))
.flatMap(requestBody -> Try.withCatch(() -> httpClient.execute(requestBody)))
.onFail(e -> LOG.error("failed to execute request:{} because of the following reason:{}",payload, e.getMessage()));
If successful return completablefuture
The text was updated successfully, but these errors were encountered:
How to throw exception if one of the operations faile
If successful return completablefuture
The text was updated successfully, but these errors were encountered: