Skip to content

Commit

Permalink
Fix for handling error in resttemplate (#17381)
Browse files Browse the repository at this point in the history
* Fix with handling error

* Fix with handling error
  • Loading branch information
rubiniselvaraj authored Dec 13, 2023
1 parent 64c85a8 commit 4c4388e
Show file tree
Hide file tree
Showing 8 changed files with 32 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -784,6 +784,10 @@ public class ApiClient{{#jsr310}} extends JavaTimeFormatter{{/jsr310}} {
}
}
if (responseEntity == null) {
throw new RestClientException("API returned HttpServerErrorException");
}
if (responseEntity.getStatusCode().is2xxSuccessful()) {
return responseEntity;
} else {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -700,6 +700,10 @@ public <T> ResponseEntity<T> invokeAPI(String path, HttpMethod method, Map<Strin
}
}

if (responseEntity == null) {
throw new RestClientException("API returned HttpServerErrorException");
}

if (responseEntity.getStatusCode().is2xxSuccessful()) {
return responseEntity;
} else {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -643,6 +643,10 @@ public <T> ResponseEntity<T> invokeAPI(String path, HttpMethod method, Map<Strin
}
}

if (responseEntity == null) {
throw new RestClientException("API returned HttpServerErrorException");
}

if (responseEntity.getStatusCode().is2xxSuccessful()) {
return responseEntity;
} else {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -692,6 +692,10 @@ public <T> ResponseEntity<T> invokeAPI(String path, HttpMethod method, Map<Strin
}
}

if (responseEntity == null) {
throw new RestClientException("API returned HttpServerErrorException");
}

if (responseEntity.getStatusCode().is2xxSuccessful()) {
return responseEntity;
} else {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -692,6 +692,10 @@ public <T> ResponseEntity<T> invokeAPI(String path, HttpMethod method, Map<Strin
}
}

if (responseEntity == null) {
throw new RestClientException("API returned HttpServerErrorException");
}

if (responseEntity.getStatusCode().is2xxSuccessful()) {
return responseEntity;
} else {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -692,6 +692,10 @@ public <T> ResponseEntity<T> invokeAPI(String path, HttpMethod method, Map<Strin
}
}

if (responseEntity == null) {
throw new RestClientException("API returned HttpServerErrorException");
}

if (responseEntity.getStatusCode().is2xxSuccessful()) {
return responseEntity;
} else {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -755,6 +755,10 @@ public <T> ResponseEntity<T> invokeAPI(String path, HttpMethod method, Map<Strin
}
}

if (responseEntity == null) {
throw new RestClientException("API returned HttpServerErrorException");
}

if (responseEntity.getStatusCode().is2xxSuccessful()) {
return responseEntity;
} else {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -750,6 +750,10 @@ public <T> ResponseEntity<T> invokeAPI(String path, HttpMethod method, Map<Strin
}
}

if (responseEntity == null) {
throw new RestClientException("API returned HttpServerErrorException");
}

if (responseEntity.getStatusCode().is2xxSuccessful()) {
return responseEntity;
} else {
Expand Down

0 comments on commit 4c4388e

Please sign in to comment.