Skip to content

Commit

Permalink
fix: return 404 when product not found
Browse files Browse the repository at this point in the history
  • Loading branch information
ananyalohani committed Nov 10, 2021
1 parent 49c3957 commit 8ae95d3
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions src/routes/products.ts
Original file line number Diff line number Diff line change
Expand Up @@ -319,6 +319,11 @@ route.get("/:productId", async (req, res, next) => {
},
});

if (!product) {
respond(res, req, 404, "Product not found.", null);
return;
}

convertImagePath(product);
respond(res, req, 200, "success", product);
} catch (err) {
Expand Down

0 comments on commit 8ae95d3

Please sign in to comment.