diff options
-rw-r--r-- | src/main/java/bitbucketpullrequestbuilder/bitbucketpullrequestbuilder/bitbucket/ApiClient.java | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/src/main/java/bitbucketpullrequestbuilder/bitbucketpullrequestbuilder/bitbucket/ApiClient.java b/src/main/java/bitbucketpullrequestbuilder/bitbucketpullrequestbuilder/bitbucket/ApiClient.java index cb14908..cf3675c 100644 --- a/src/main/java/bitbucketpullrequestbuilder/bitbucketpullrequestbuilder/bitbucket/ApiClient.java +++ b/src/main/java/bitbucketpullrequestbuilder/bitbucketpullrequestbuilder/bitbucket/ApiClient.java @@ -256,8 +256,12 @@ public class ApiClient { client.getState().setCredentials(AuthScope.ANY, credentials); client.getParams().setAuthenticationPreemptive(true); try { - client.executeMethod(req); - return req.getResponseBodyAsString(); + int statusCode = client.executeMethod(req); + if (statusCode != HttpStatus.SC_OK) { + logger.log(Level.WARNING, "Response code failed: " + req.getStatusLine()); + }else{ + return req.getResponseBodyAsString(); + } } catch (HttpException e) { logger.log(Level.WARNING, "Failed to send request.", e); } catch (IOException e) { |