diff options
Diffstat (limited to 'src/io/OAuthRequester.java')
-rw-r--r-- | src/io/OAuthRequester.java | 11 |
1 files changed, 9 insertions, 2 deletions
diff --git a/src/io/OAuthRequester.java b/src/io/OAuthRequester.java index 3621186..9cde429 100644 --- a/src/io/OAuthRequester.java +++ b/src/io/OAuthRequester.java @@ -3,6 +3,8 @@ package io; import java.io.IOException; import java.net.HttpURLConnection; import java.net.URLConnection; +import java.util.logging.Level; +import java.util.logging.Logger; import oauth.signpost.OAuth; import oauth.signpost.OAuthConsumer; import oauth.signpost.basic.DefaultOAuthConsumer; @@ -136,7 +138,12 @@ public class OAuthRequester extends AbstractRequester { public boolean isValid() throws IOException { // NOTE: this actually contributes to the ratelimit (12/minute) // TODO: find alternative that does not hit the ratelimit - Response obj = getJSON("application/rate_limit_status"); - return !obj.getResp().getAsJsonObject().has("errors"); + Response obj; + try { + obj = getJSON("application/rate_limit_status"); + return !obj.getResp().getAsJsonObject().has("errors"); + } catch (RateLimitException ex) { + return false; + } } } |