diff --git a/buildSrc/src/main/java/org/springframework/boot/build/bom/bomr/github/StandardGitHubRepository.java b/buildSrc/src/main/java/org/springframework/boot/build/bom/bomr/github/StandardGitHubRepository.java index ea98d1ce9c..2c9059f3ec 100644 --- a/buildSrc/src/main/java/org/springframework/boot/build/bom/bomr/github/StandardGitHubRepository.java +++ b/buildSrc/src/main/java/org/springframework/boot/build/bom/bomr/github/StandardGitHubRepository.java @@ -23,6 +23,8 @@ import java.util.function.Function; import java.util.stream.Collectors; import org.springframework.http.ResponseEntity; +import org.springframework.web.client.HttpClientErrorException.Forbidden; +import org.springframework.web.client.RestClientException; import org.springframework.web.client.RestTemplate; /** @@ -56,8 +58,16 @@ final class StandardGitHubRepository implements GitHubRepository { catch (InterruptedException ex) { Thread.currentThread().interrupt(); } - ResponseEntity response = this.rest.postForEntity("issues", requestBody, Map.class); - return (Integer) response.getBody().get("number"); + try { + ResponseEntity response = this.rest.postForEntity("issues", requestBody, Map.class); + return (Integer) response.getBody().get("number"); + } + catch (RestClientException ex) { + if (ex instanceof Forbidden) { + System.out.println("Received 403 response with headers " + ((Forbidden) ex).getResponseHeaders()); + } + throw ex; + } } @Override