aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authormat-1 <github@matdoes.dev>2021-03-25 03:19:10 +0000
committermat-1 <github@matdoes.dev>2021-03-25 03:19:10 +0000
commitcc0b5170fa591dfc0b3c4856d6114893c48d89f7 (patch)
tree30d2940ae8d43cdb9db89d73b5a3224c246a2a06
parent1708632ee4746e116a21c546943381cce50ddc43 (diff)
downloadskyblock-api-cc0b5170fa591dfc0b3c4856d6114893c48d89f7.tar.gz
skyblock-api-cc0b5170fa591dfc0b3c4856d6114893c48d89f7.tar.bz2
skyblock-api-cc0b5170fa591dfc0b3c4856d6114893c48d89f7.zip
Compiled TS into JS
-rw-r--r--build/mojang.js12
1 files changed, 11 insertions, 1 deletions
diff --git a/build/mojang.js b/build/mojang.js
index 2348a0a..ae0e1e6 100644
--- a/build/mojang.js
+++ b/build/mojang.js
@@ -21,7 +21,17 @@ async function mojangDataFromUuid(uuid) {
const fetchResponse = await node_fetch_1.default(
// using mojang directly is faster than ashcon lol, also mojang removed the ratelimits from here
`https://sessionserver.mojang.com/session/minecraft/profile/${util_1.undashUuid(uuid)}`, { agent: () => httpsAgent });
- const data = await fetchResponse.json();
+ let data;
+ try {
+ data = await fetchResponse.json();
+ }
+ catch {
+ // if it errors, just return null
+ return {
+ uuid: null,
+ username: null
+ };
+ }
return {
uuid: data.id,
username: data.name