mirror of
https://github.com/NohamR/lanyard-profile-readme.git
synced 2026-05-26 04:17:19 +00:00
Feat: Give a different response when its an invalid user
This commit is contained in:
@@ -31,6 +31,9 @@ export default async function handler(req: NextApiRequest, res: NextApiResponse<
|
|||||||
axiosRes = await axios.get(`https://api.lanyard.rest/v1/users/${userid}`);
|
axiosRes = await axios.get(`https://api.lanyard.rest/v1/users/${userid}`);
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
console.log(err);
|
console.log(err);
|
||||||
|
|
||||||
|
if (err.response.status === 404) return res.send({ error: "Invalid user!" });
|
||||||
|
|
||||||
return res.send({
|
return res.send({
|
||||||
error: `Something went wrong! If everything looks correct and this still occurs, please contact @cnraddd on Twitter.`,
|
error: `Something went wrong! If everything looks correct and this still occurs, please contact @cnraddd on Twitter.`,
|
||||||
});
|
});
|
||||||
|
|||||||
Reference in New Issue
Block a user