UNPKG

express-errorhandlers

Version:
20 lines 798 B
"use strict"; var __importDefault = (this && this.__importDefault) || function (mod) { return (mod && mod.__esModule) ? mod : { "default": mod }; }; Object.defineProperty(exports, "__esModule", { value: true }); const debug_1 = __importDefault(require("debug")); const log = debug_1.default('express-errorhandler:not_found'); const handler_1 = __importDefault(require("../handler")); const DEFAULT_MESSAGE = 'Not Found'; /** * catch 404 and forward to error handler */ exports.default = (message = DEFAULT_MESSAGE, extra = {}, extraDebug = {}) => { return (_req, _res, next) => { const handler = new handler_1.default(undefined, 404, message, extra, extraDebug); log('not found %O', handler.toData()); next(handler); }; }; //# sourceMappingURL=not_found.js.map