JoshMerlino / namemc

The unofficial Node JS API for looking up Minecraft users on Name MC
https://www.npmjs.com/package/namemc
MIT License
13 stars 5 forks source link

Calling `lookupName` on an account that does not have any NameMC records will break everything #38

Closed jamesonknutson closed 3 years ago

jamesonknutson commented 3 years ago

Describe the Bug 🐜 When you call lookupName on an account username that does not have any NameMC records, no stack trace is thrown and the entire script seems to just die.

To Reproduce Call lookupName on an account without NameMC records. To replicate my environment, you can try testing against the username: mattrix1516.

const NameMC = require("namemc");
(async () => {
    const username = 'mattrix1516';
    const playerData = await NameMC.lookupName(username);
    console.log(playerData);
})

Call Stack No call stack was thrown. The entire caller script seems to just exit. Not sure if that's just due to my own piss-poor code writing or if it's something to do with the library, though.

Expected Behavior The function should return undefined or null if no valid playerData could be found from nameMC.

JoshMerlino commented 3 years ago

If the user is not found, it will now throw this error:

throw new Error("Username is not in use.");