aboutsummaryrefslogtreecommitdiff
path: root/src/hypixelApi.ts
diff options
context:
space:
mode:
Diffstat (limited to 'src/hypixelApi.ts')
-rw-r--r--src/hypixelApi.ts9
1 files changed, 8 insertions, 1 deletions
diff --git a/src/hypixelApi.ts b/src/hypixelApi.ts
index fdb4535..35d46cb 100644
--- a/src/hypixelApi.ts
+++ b/src/hypixelApi.ts
@@ -145,7 +145,8 @@ export async function sendApiRequest({ path, key, args }): Promise<HypixelRespon
{ agent: () => httpsAgent }
)
fetchJsonParsed = await fetchResponse.json()
- } catch {
+ } catch (err) {
+ console.debug('error? ok retrying', err)
// if there's an error, wait a second and try again
await new Promise((resolve) => setTimeout(resolve, 1000))
return await sendApiRequest({ path, key, args })
@@ -166,12 +167,18 @@ export async function sendApiRequest({ path, key, args }): Promise<HypixelRespon
}
if (fetchJsonParsed.throttle) {
+ console.log('bruh, throttled')
if (apiKeyUsage[key])
apiKeyUsage[key].remaining = 0
// if it's throttled, wait 10 seconds and try again
await new Promise((resolve) => setTimeout(resolve, 10000))
return await sendApiRequest({ path, key, args })
}
+
+ console.log(path, args, fetchJsonParsed.success)
+ if (!fetchJsonParsed.success) {
+ console.log(fetchJsonParsed)
+ }
return fetchJsonParsed
}