From a4f3110c7a716188f97b060be32d58a9a47ad4a7 Mon Sep 17 00:00:00 2001 From: anys34 Date: Mon, 28 Aug 2023 08:41:13 +0900 Subject: [PATCH] ADD :: error --- routes/search.js | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/routes/search.js b/routes/search.js index ab4eec2..bb39fec 100644 --- a/routes/search.js +++ b/routes/search.js @@ -33,14 +33,19 @@ router.get("/:id", async (req, res) => { commit: commit, }); if (user_Info.length > 0) { - return res.send(user_Info); + return res.status(200).send(user_Info); } if (!(user_Info.length > 0)) { - return res.send("not found"); + return res.status(500).send("not found"); } } catch (error) { - console.log(error); - res.status(500).send(error); + console.log(error.response.status); + if (error.response.status == 404) { + return res.status(200).send("not found"); + } + if (error.response.status != 404) { + return res.status(500).send(error); + } } });