fix WebRequest#getAsEntity
All checks were successful
Deploy to Dokku / docker (ubuntu-latest) (push) Successful in 51s

This commit is contained in:
Lee 2024-07-03 00:39:20 +01:00
parent 6202aa6691
commit da06a01097

@ -31,6 +31,7 @@ public class WebRequest {
* @return the response * @return the response
*/ */
public static <T> T getAsEntity(String url, Class<T> clazz) throws RateLimitException { public static <T> T getAsEntity(String url, Class<T> clazz) throws RateLimitException {
try {
ResponseEntity<T> responseEntity = CLIENT.get() ResponseEntity<T> responseEntity = CLIENT.get()
.uri(url) .uri(url)
.retrieve() .retrieve()
@ -45,6 +46,11 @@ public class WebRequest {
throw new RateLimitException("Rate limit reached"); throw new RateLimitException("Rate limit reached");
} }
return responseEntity.getBody(); return responseEntity.getBody();
} catch (RateLimitException e) {
throw e;
} catch (Exception e) {
return null;
}
} }
/** /**