Skip to content

Commit

Permalink
feat: Add handling for http failure node #SP1-952
Browse files Browse the repository at this point in the history
  • Loading branch information
vigneshwarKV committed Mar 14, 2024
1 parent bb13ac7 commit bd17968
Showing 1 changed file with 9 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.Objects;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
Expand Down Expand Up @@ -118,7 +119,9 @@ public void start(WorkflowModel workflow, TaskModel task, WorkflowExecutor execu
if (response.body != null) {
task.setReasonForIncompletion(response.body.toString());
} else {
task.setReasonForIncompletion("No response from the remote service");
task.setReasonForIncompletion(
Objects.requireNonNullElse(
response.reasonPhrase, "No response from the remote service"));
}
task.setStatus(TaskModel.Status.FAILED);
}
Expand Down Expand Up @@ -182,11 +185,11 @@ protected HttpResponse httpCall(Input input) throws Exception {
response.headers = responseEntity.getHeaders();
return response;
} catch (HttpClientErrorException ex) {
response.headers = ex.getResponseHeaders();
response.statusCode = ex.getStatusCode().value();
response.reasonPhrase = ex.getStatusText();
return response;
} catch (RestClientException ex) {
response.headers = ex.getResponseHeaders();
response.statusCode = ex.getStatusCode().value();
response.reasonPhrase = ex.getStatusText();
return response;
} catch (RestClientException ex) {
LOGGER.error(
String.format(
"Got unexpected http response - uri: %s, vipAddress: %s",
Expand Down

0 comments on commit bd17968

Please sign in to comment.