diff options
author | mat <github@matdoes.dev> | 2021-06-16 22:03:23 -0500 |
---|---|---|
committer | mat <github@matdoes.dev> | 2021-06-16 22:03:23 -0500 |
commit | 8387ce2ad19068bf9c8299c193fdc0f5e933de6f (patch) | |
tree | 0cfce97fb26678ca7465d110607fb7d0016f6ad8 /build/mojang.js | |
parent | 134abd6cca8827ce7a7803a64f4d11a18000c038 (diff) | |
download | skyblock-api-8387ce2ad19068bf9c8299c193fdc0f5e933de6f.tar.gz skyblock-api-8387ce2ad19068bf9c8299c193fdc0f5e933de6f.tar.bz2 skyblock-api-8387ce2ad19068bf9c8299c193fdc0f5e933de6f.zip |
why did it break
Diffstat (limited to 'build/mojang.js')
-rw-r--r-- | build/mojang.js | 12 |
1 files changed, 11 insertions, 1 deletions
diff --git a/build/mojang.js b/build/mojang.js index b740c5a..5216d39 100644 --- a/build/mojang.js +++ b/build/mojang.js @@ -29,14 +29,24 @@ async function profileFromUuid(uuid) { await new Promise((resolve) => setTimeout(resolve, 1000)); return await profileFromUuid(uuid); } + let dataString; + try { + dataString = await fetchResponse.text(); + } + catch { + return { uuid: null, username: null }; + } let data; try { - data = await fetchResponse.json(); + data = JSON.parse(dataString); } catch { + console.log('mojang response:', dataString); // if it errors, just return null return { uuid: null, username: null }; } + if (!data.id) + console.log('mojang response:', data); return { uuid: data.id, username: data.name |