Now I have it like this:
protected static ResponseEntity<?> actualResponse;
protected static RestClientResponseException actualErrorResponse;
try{
actualResponse = REST_CLIENT.get()
.uri(uriPath, CUSTOMER_NUMBER)
.retrieve()
.toEntity(payloadType);
} catch (final RestClientResponseException e) {
actualErrorResponse = e;
}
Is there any way to extract exception in functional style?
I've tried this:
.onStatus(HttpStatusCode::isError, ((request, response) -> {
response.getBody()
But it returns InputStream that requires addition transforming to String/Exception object.