@@ -61,7 +61,7 @@ JSONObject performGetBot(@NotNull String id, boolean disableCache){
6161
6262 try {
6363 return performGET (url );
64- }catch (IOException | RatelimitedException ex ){
64+ }catch (IOException ex ){
6565 ex .printStackTrace ();
6666 return null ;
6767 }
@@ -85,7 +85,7 @@ JSONObject performGetList(@NotNull String id, @Nullable String site, boolean dis
8585 return listCache .get (id , k -> {
8686 try {
8787 return performGET (finalUrl );
88- }catch (IOException | RatelimitedException ex ){
88+ }catch (IOException ex ){
8989 ex .printStackTrace ();
9090 return null ;
9191 }
@@ -94,14 +94,14 @@ JSONObject performGetList(@NotNull String id, @Nullable String site, boolean dis
9494
9595 try {
9696 return performGET (url );
97- }catch (IOException | RatelimitedException ex ){
97+ }catch (IOException ex ){
9898 ex .printStackTrace ();
9999 return null ;
100100 }
101101
102102 }
103103
104- private JSONObject performGET (@ NotNull String url ) throws IOException , RatelimitedException {
104+ private JSONObject performGET (@ NotNull String url ) throws IOException {
105105 Request request = new Request .Builder ()
106106 .url (url )
107107 .build ();
@@ -111,12 +111,13 @@ private JSONObject performGET(@NotNull String url) throws IOException, Ratelimit
111111 if (body == null )
112112 throw new NullPointerException ("Received empty response body." );
113113
114- if (body .string ().isEmpty ())
114+ String bodyString = body .string ();
115+ if (bodyString .isEmpty ())
115116 throw new NullPointerException ("Received empty response body." );
116117
117118 if (!response .isSuccessful ()){
118119 if (response .code () == 429 )
119- throw new RatelimitedException (body . string () );
120+ throw new RatelimitedException (bodyString );
120121
121122 throw new IOException (String .format (
122123 "Could not retrieve information. The server responded with error code %d (%s)." ,
@@ -125,11 +126,11 @@ private JSONObject performGET(@NotNull String url) throws IOException, Ratelimit
125126 ));
126127 }
127128
128- return new JSONObject (body . string () );
129+ return new JSONObject (bodyString );
129130 }
130131 }
131132
132- void performPOST (@ NotNull JSONObject json , int sites ) throws IOException , RatelimitedException {
133+ void performPOST (@ NotNull JSONObject json , int sites ) throws IOException {
133134 if (sites < 1 )
134135 throw new IllegalStateException ("POST action requires at least one site!" );
135136
@@ -154,12 +155,13 @@ void performPOST(@NotNull JSONObject json, int sites) throws IOException, Rateli
154155 if (responseBody == null )
155156 throw new NullPointerException ("Received empty response body." );
156157
157- if (responseBody .string ().isEmpty ())
158+ String bodyString = responseBody .string ();
159+ if (bodyString .isEmpty ())
158160 throw new NullPointerException ("Received empty response body." );
159161
160162 if (!response .isSuccessful ()){
161163 if (response .code () == 429 )
162- throw new RatelimitedException (responseBody . string () );
164+ throw new RatelimitedException (bodyString );
163165
164166 throw new IOException (String .format (
165167 "Could not post Guild count. The server responded with error code %d (%s)" ,
0 commit comments