aboutsummaryrefslogtreecommitdiff
path: root/src/main/java
diff options
context:
space:
mode:
authorDaniel Fly <dn@smartweb.dk>2017-06-22 13:46:44 +0200
committerDaniel Fly <dn@smartweb.dk>2017-06-22 13:46:44 +0200
commitae9f49152ef726dedea1ba5ce29517979ada7e51 (patch)
tree4bd18af8a0c3701e46d3e95314420ab0022a0347 /src/main/java
parent2a767254d838c339cd8856648b4edbc410189a30 (diff)
downloadbbprb-ae9f49152ef726dedea1ba5ce29517979ada7e51.tar.gz
Improved logging for thoubleshooting
Diffstat (limited to 'src/main/java')
-rw-r--r--src/main/java/bitbucketpullrequestbuilder/bitbucketpullrequestbuilder/bitbucket/ApiClient.java8
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) {