From 58807d12eefe264e817d8dc4b7075dbb25e4c2d2 Mon Sep 17 00:00:00 2001 From: mat Date: Sun, 9 May 2021 20:05:14 -0500 Subject: temp debug stuff --- src/constants.ts | 4 +++- src/hypixelApi.ts | 9 ++++++++- src/index.ts | 2 +- 3 files changed, 12 insertions(+), 3 deletions(-) (limited to 'src') diff --git a/src/constants.ts b/src/constants.ts index 52c104c..6c5c1c5 100644 --- a/src/constants.ts +++ b/src/constants.ts @@ -47,7 +47,8 @@ async function fetchGithubApi(method: string, route: string, headers?: any, json }, headers), } ) - } catch { + } catch (err) { + console.log('bruh, errored', err) // if there's an error, wait a second and try again await new Promise((resolve) => setTimeout(resolve, 1000)) return await fetchGithubApi(method, route, headers, json) @@ -86,6 +87,7 @@ function fetchFile(path: string): Promise { }, ) const data = await r.json() + console.log('ok github api returned') const file = { path: data.path, 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 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 setTimeout(resolve, 10000)) return await sendApiRequest({ path, key, args }) } + + console.log(path, args, fetchJsonParsed.success) + if (!fetchJsonParsed.success) { + console.log(fetchJsonParsed) + } return fetchJsonParsed } diff --git a/src/index.ts b/src/index.ts index 1652428..6f3b94f 100644 --- a/src/index.ts +++ b/src/index.ts @@ -6,7 +6,7 @@ import express from 'express' const app = express() -export const debug = false +export const debug = true // 200 requests over 5 minutes -- cgit