diff options
author | Daniel Fly <dn@smartweb.dk> | 2017-06-22 13:46:44 +0200 |
---|---|---|
committer | Daniel Fly <dn@smartweb.dk> | 2017-06-22 13:46:44 +0200 |
commit | ae9f49152ef726dedea1ba5ce29517979ada7e51 (patch) | |
tree | 4bd18af8a0c3701e46d3e95314420ab0022a0347 /src | |
parent | 2a767254d838c339cd8856648b4edbc410189a30 (diff) | |
download | bbprb-ae9f49152ef726dedea1ba5ce29517979ada7e51.tar.gz |
Improved logging for thoubleshooting
Diffstat (limited to 'src')
-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) { |