UNPKG

sipp

Version:

An Opinionated, High-Productivity MVC Web Framework in TypeScript

43 lines 2.11 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.devExceptionView = exports.productionExceptionView = void 0; const jsx_1 = require("../jsx"); const productionExceptionView = (reqId) => { return (jsx_1.h("html", null, jsx_1.h("head", null, jsx_1.h("title", null, "Error!"), jsx_1.h("style", null)), jsx_1.h("body", { style: "background-color: #f7fafc;" }, jsx_1.h("div", { style: "margin: 4em auto; max-width: 50vw; min-width: 300px; padding: 2em; background-color: #fff; box-shadow: 5px 5px 15px #eee; text-align: center" }, jsx_1.h("h1", null, "Whoops! You encountered an error."), jsx_1.h("div", null, "Request ID: ", reqId))))); }; exports.productionExceptionView = productionExceptionView; const devExceptionView = (exception, req, res) => { return (jsx_1.h("html", null, jsx_1.h("head", null, jsx_1.h("title", null, "Exception: ", exception.message)), jsx_1.h("body", { style: "background-color: #f7fafc; padding: 2em;" }, jsx_1.h("div", { style: "margin: 0 auto; width: 90vw; padding: 2em; background-color: #fff; box-shadow: 5px 5px 15px #eee" }, jsx_1.h("h1", null, "Message: ", exception.message), exception.getDescription() ? (jsx_1.h("p", null, exception.getDescription())) : null, jsx_1.h("div", null, jsx_1.h("b", null, "Status:"), " ", res.statusCode), jsx_1.h("div", null, jsx_1.h("b", null, "Req Id:"), " ", req.id), jsx_1.h("div", null, jsx_1.h("b", null, "Stack:"), jsx_1.h("ul", null, exception.stack.split('\n').map((line) => (jsx_1.h("li", { style: "display: block;" }, line))))))))); }; exports.devExceptionView = devExceptionView; //# sourceMappingURL=exception.js.map