@lottojs/lotto
Version:
Simple, lightweight and dependency-free NodeJS web application framework.
28 lines • 1.02 kB
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
exports.internalError = exports.notFoundError = exports.badRequestError = void 0;
const utils_1 = require("../utils/utils");
const debug = (0, utils_1.toDebug)('router:errors');
function badRequestError(res) {
debug(`400 Bad Request [${res.req.method}] - ${res.req.url}`);
res.status(400).json({
message: `bad request.`,
});
}
exports.badRequestError = badRequestError;
function notFoundError(res) {
debug(`404 Not Found [${res.req.method}] - ${res.req.url}`);
res.status(404).json({
message: `route ${res.req.url} not found.`,
});
}
exports.notFoundError = notFoundError;
function internalError(res, error) {
debug(`500 Internal Server Error [${res.req.method}] - ${res.req.url}`);
res.status(500).json(error.message ||
(0, utils_1.toString)({
message: 'Internal Server Error',
}));
}
exports.internalError = internalError;
//# sourceMappingURL=router.errors.js.map