So my Logging error works as expected, however with this line of code:
throw new Error("Could not get the genres.")
the code down below it in my router.get function is “unreachable”. Is that expected?
Here’s my code:
router.get("/", async (req, res) => {
throw new Error("Could not get the genres.");
const genres = await Genre.find().sort("name");
res.send(genres);
});