From fa38dec763635fdc46618e36efabb23668aa7364 Mon Sep 17 00:00:00 2001 From: Aleksey Pivovarov Date: Thu, 1 Aug 2013 11:57:17 +0400 Subject: [PATCH] Github: fix error message --- .../plugins/github/api/GithubApiUtil.java | 16 ++++------------ 1 file changed, 4 insertions(+), 12 deletions(-) diff --git a/plugins/github/src/org/jetbrains/plugins/github/api/GithubApiUtil.java b/plugins/github/src/org/jetbrains/plugins/github/api/GithubApiUtil.java index ce78baaa2ddc..6030bd3f41ed 100644 --- a/plugins/github/src/org/jetbrains/plugins/github/api/GithubApiUtil.java +++ b/plugins/github/src/org/jetbrains/plugins/github/api/GithubApiUtil.java @@ -198,30 +198,22 @@ public class GithubApiUtil { case HttpStatus.SC_NOT_FOUND: throw new GithubAuthenticationException("Request response: " + getErrorMessage(method)); default: - throw new HttpException(code + ": " + method.getStatusText()); + throw new HttpException(code + ": " + getErrorMessage(method)); } } @NotNull private static String getErrorMessage(@NotNull HttpMethod method) { - String message = null; try { InputStream resp = method.getResponseBodyAsStream(); if (resp != null) { GithubErrorMessageRaw error = fromJson(parseResponse(resp), GithubErrorMessageRaw.class); - message = error.getMessage(); + return method.getStatusText() + " - " + error.getMessage(); } } - catch (IOException e) { - message = null; - } - - if (message != null) { - return message; - } - else { - return method.getStatusText(); + catch (IOException ignore) { } + return method.getStatusText(); } @NotNull