Feat: Give a different response when its an invalid user

This commit is contained in:
looskie
2021-06-22 14:08:53 -04:00
parent ef50c96431
commit 82ff136c9b

View File

@@ -31,6 +31,9 @@ export default async function handler(req: NextApiRequest, res: NextApiResponse<
axiosRes = await axios.get(`https://api.lanyard.rest/v1/users/${userid}`);
} catch (err) {
console.log(err);
if (err.response.status === 404) return res.send({ error: "Invalid user!" });
return res.send({
error: `Something went wrong! If everything looks correct and this still occurs, please contact @cnraddd on Twitter.`,
});