-
Sub-task
-
Resolution: Unresolved
-
Medium
-
None
-
None
-
None
With the introduction of WebClient the error handling should be refactored to leverage on the capabilities of the new library.
But at the same time we must preserve the current error handling mechanisms to comply with the customer's requirements
example error handling:
return webClient .get() .uri(resourceUrl) .header(HttpHeaders.CONTENT_TYPE, MediaType.APPLICATION_JSON_VALUE) .retrieve() .onStatus(HttpStatus::is4xxClientError, error -> Mono.error(new RuntimeException("API not found"))) .onStatus(HttpStatus::is5xxServerError, error -> Mono.error(new RuntimeException("Server is not responding"))) .bodyToMono(String.class);