@hoangnam.io/qa-tools
Version:
Logging, Error handling, Notifying for Express codebase
17 lines (12 loc) • 413 B
JavaScript
const { InputDataInvalid } = require("./error-handling/errors");
const router = require("express").Router();
router.post("/test", async (req, res, next) => {
// throw new InputDataInvalid("some input data is invalid");
try {
// throw new InputDataInvalid("some input data is invalid");
throw new Error("something went wrong");
} catch (error) {
next(error);
}
});
module.exports = router;