Add additional check for error

This commit is contained in:
2021-01-10 19:44:16 +01:00
parent c1e8c901cd
commit dd9c8cc0af

View File

@@ -16,6 +16,7 @@ public class APIFootballUpdater {
private final String exceededLimitDayError = "{\"api\":{\"results\":0,\"error\":\"You have reached the request limit for the day\"}}"; private final String exceededLimitDayError = "{\"api\":{\"results\":0,\"error\":\"You have reached the request limit for the day\"}}";
private final String exceededLimitMinuteError = "{\"api\":{\"results\":0,\"error\":\"Too many requests. Your rate limit is 10 requests per minute.\"}}"; private final String exceededLimitMinuteError = "{\"api\":{\"results\":0,\"error\":\"Too many requests. Your rate limit is 10 requests per minute.\"}}";
private final String exceededLimitMinuteError2 = "{\"api\":{\"results\":0,\"status\":\"Too many requests. Your rate limit is 10 requests per minute.\"}}";
private final String wrongEndpointError = "{\"api\":{\"results\":0,\"error\":\"This endpoint does not exist or your parameters are incorrect, contact our support.\"}}"; private final String wrongEndpointError = "{\"api\":{\"results\":0,\"error\":\"This endpoint does not exist or your parameters are incorrect, contact our support.\"}}";
public APIFootballUpdater() { public APIFootballUpdater() {
@@ -103,6 +104,9 @@ public class APIFootballUpdater {
if (result.toString().equals(exceededLimitMinuteError)) { if (result.toString().equals(exceededLimitMinuteError)) {
throw new Exception(requestUrl + " gave error:" + exceededLimitMinuteError); throw new Exception(requestUrl + " gave error:" + exceededLimitMinuteError);
} }
if (result.toString().equals(exceededLimitMinuteError2)) {
throw new Exception(requestUrl + " gave error:" + exceededLimitMinuteError2);
}
return result.toString(); return result.toString();
} }