UNPKG

sipp

Version:

An Opinionated, High-Productivity MVC Web Framework in TypeScript

25 lines 964 B
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.ExceptionHandler = void 0; const exception_1 = require("./exception"); const Responder_1 = require("../http/response/Responder"); class ExceptionHandler extends Responder_1.HTTPResponder { constructor(logger, mode) { super(); this.logger = logger; this.mode = mode; } handle(exception, req, res) { this.logger.error(`${exception.constructor.name}: ${exception.message}`); if (!res.headersSent) { return this.reply(this.mode === 'production' ? exception_1.productionExceptionView(req.id) : exception_1.devExceptionView(exception, req, res), undefined, exception.code); } return false; } reportHandledException(exception) { } reportUnhandledException(exception) { } } exports.ExceptionHandler = ExceptionHandler; //# sourceMappingURL=ExceptionHandler.js.map