|
25 | 25 | import org.springframework.http.*; |
26 | 26 | import org.springframework.stereotype.Component; |
27 | 27 | import org.springframework.util.MultiValueMap; |
28 | | -import org.springframework.web.client.HttpClientErrorException; |
| 28 | +import org.springframework.web.client.HttpStatusCodeException; |
29 | 29 | import org.springframework.web.client.RestClientException; |
30 | 30 | import org.springframework.web.client.RestTemplate; |
31 | 31 |
|
@@ -120,8 +120,12 @@ public void start(WorkflowModel workflow, TaskModel task, WorkflowExecutor execu |
120 | 120 | task.setReasonForIncompletion(response.body.toString()); |
121 | 121 | } else { |
122 | 122 | task.setReasonForIncompletion( |
123 | | - Objects.requireNonNullElse( |
124 | | - response.reasonPhrase, "No response from the remote service")); |
| 123 | + String.format( |
| 124 | + "%d: %s", |
| 125 | + response.statusCode, |
| 126 | + Objects.requireNonNullElse( |
| 127 | + response.reasonPhrase, |
| 128 | + "No response from the remote service"))); |
125 | 129 | } |
126 | 130 | task.setStatus(TaskModel.Status.FAILED); |
127 | 131 | } |
@@ -184,7 +188,7 @@ protected HttpResponse httpCall(Input input) throws Exception { |
184 | 188 | HttpStatus.valueOf(responseEntity.getStatusCode().value()).getReasonPhrase(); |
185 | 189 | response.headers = responseEntity.getHeaders(); |
186 | 190 | return response; |
187 | | - } catch (HttpClientErrorException ex) { |
| 191 | + } catch (HttpStatusCodeException ex) { |
188 | 192 | response.headers = ex.getResponseHeaders(); |
189 | 193 | response.statusCode = ex.getStatusCode().value(); |
190 | 194 | response.reasonPhrase = ex.getStatusText(); |
|
0 commit comments