mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
Github: parse detailed GitHub errors
This commit is contained in:
@@ -17,15 +17,34 @@ package org.jetbrains.plugins.github.api;
|
||||
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @author Aleksey Pivovarov
|
||||
*/
|
||||
@SuppressWarnings("UnusedDeclaration")
|
||||
class GithubErrorMessageRaw {
|
||||
@Nullable private String message;
|
||||
@Nullable public String message;
|
||||
@Nullable public List<Error> errors;
|
||||
|
||||
private static class Error {
|
||||
@Nullable public String resource;
|
||||
@Nullable public String code;
|
||||
@Nullable public String message;
|
||||
}
|
||||
|
||||
@Nullable
|
||||
public String getMessage() {
|
||||
return message;
|
||||
if (errors == null) {
|
||||
return message;
|
||||
}
|
||||
else {
|
||||
StringBuilder s = new StringBuilder(message);
|
||||
for (Error e : errors) {
|
||||
s.append("<br/>").append("[").append(e.resource).append("]").append(e.code).append(": ").append(e.message);
|
||||
}
|
||||
return s.toString();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user