diff options
-rw-r--r-- | build/mojang.js | 7 | ||||
-rw-r--r-- | src/mojang.ts | 8 |
2 files changed, 7 insertions, 8 deletions
diff --git a/build/mojang.js b/build/mojang.js index c33445a..86e44d8 100644 --- a/build/mojang.js +++ b/build/mojang.js @@ -33,7 +33,8 @@ async function profileFromUuid(uuid) { try { dataString = await fetchResponse.text(); } - catch { + catch (err) { + console.log('failed reading response text', err); return { uuid: null, username: null }; } let data; @@ -45,8 +46,7 @@ async function profileFromUuid(uuid) { // if it errors, just return null return { uuid: null, username: null }; } - if (!data.id) - console.log('mojang response:', data); + console.log('mojang response:', data); return { uuid: data.id, username: data.name @@ -71,7 +71,6 @@ async function profileFromUsername(username) { } catch { } if (!(data === null || data === void 0 ? void 0 : data.id)) { - console.log('no id returned from mojang', rawData); // return { uuid: null, username: null } return await profileFromUsernameAlternative(username); } diff --git a/src/mojang.ts b/src/mojang.ts index 1d5809f..c5176e6 100644 --- a/src/mojang.ts +++ b/src/mojang.ts @@ -40,7 +40,8 @@ export async function profileFromUuid(uuid: string): Promise<MojangApiResponse> let dataString: string try { dataString = await fetchResponse.text() - } catch { + } catch (err) { + console.log('failed reading response text', err) return { uuid: null, username: null } } let data @@ -51,8 +52,7 @@ export async function profileFromUuid(uuid: string): Promise<MojangApiResponse> // if it errors, just return null return { uuid: null, username: null } } - if (!data.id) - console.log('mojang response:', data) + console.log('mojang response:', data) return { uuid: data.id, username: data.name @@ -84,10 +84,10 @@ export async function profileFromUsername(username: string): Promise<MojangApiRe if (!data?.id) { - console.log('no id returned from mojang', rawData) // return { uuid: null, username: null } return await profileFromUsernameAlternative(username) } + return { uuid: data.id, username: data.name |