mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-03-22 15:10:43 +07:00
Github: fix error message
This commit is contained in:
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user