fix(HC):: handle response exception
fixes gravitee-io/issues#3979
@@ -328,7 +328,8 @@ public class HttpEndpointRuleHandler implements Handler<Long> {
request.setMethod(step.getRequest().getMethod());
request.setUri(hcRequestUri.toString());
- healthRequest.handler(response -> response.bodyHandler(buffer -> {
+ healthRequest.handler(response -> {
+ response.bodyHandler(buffer -> {
long endTime = currentTimeMillis();
logger.debug("Health-check endpoint returns a response with a {} status code", response.statusCode());
@@ -370,7 +371,13 @@ public class HttpEndpointRuleHandler implements Handler<Long> {
// Close client
httpClient.close();
- }));
+ });
+ response.exceptionHandler(throwable -> {
+ logger.error("An error has occurred during Health check response handler", throwable);
+ // Close client
+ httpClient.close();
+ });
+ });
healthRequest.exceptionHandler(event -> {
long endTime = currentTimeMillis();
