Skip to content

Commit 604a6e9

Browse files
committed
Only print warn when "failure" isn't empty.
1 parent 5471d06 commit 604a6e9

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

request/src/main/java/org/botblock/javabotblockapi/requests/handler/RequestHandler.java

+3-3
Original file line numberDiff line numberDiff line change
@@ -151,14 +151,14 @@ public void performPOST(@Nonnull JSONObject json, int sites) throws IOException{
151151
}
152152

153153
throw new IOException(String.format(
154-
"Could not post Guild count. The server responded with error code %d (%s)",
154+
"Could not post Guild count. The API responded with error code %d (%s)",
155155
response.code(),
156156
response.message()
157157
));
158158
}
159159

160160
JSONObject responseJson = new JSONObject(bodyString);
161-
if(responseJson.has("failure")){
161+
if(!responseJson.getJSONObject("failure").isEmpty()){
162162
JSONObject failure = responseJson.getJSONObject("failure");
163163
JSONArray failures = new JSONArray();
164164

@@ -203,7 +203,7 @@ private JSONObject performGET(@Nonnull String url, String header) throws IOExcep
203203
}
204204

205205
throw new IOException(String.format(
206-
"Could not retrieve information. The server responded with error code %d (%s).",
206+
"Could not retrieve information. The API responded with error code %d (%s).",
207207
response.code(),
208208
response.message()
209209
));

0 commit comments

Comments
 (0)