1 | {"version":3,"file":"finalError.js","sourceRoot":"","sources":["../../../../src/lib/middleware/finalError.ts"],"names":[],"mappings":";;;;;;;;;;;IAEA,6BAAoC;IAEpC,SAAwB,UAAU;QAChC,OAAO,UAAC,KAAgB,EAAE,OAAO,EAAE,QAAQ,EAAE,CAAC;YAC5C,IAAM,OAAO,GAAG,KAAK,CAAC,MAAM;gBAC1B,CAAC,CAAC,KAAK,CAAC,OAAO;gBACf,CAAC,CAAC,mBAAY,CAAC,KAAK,CAAC,UAAU,CAAC,CAAC;YAEnC,QAAQ,CAAC,SAAS,CAAC,KAAK,CAAC,UAAU,EAAE;gBACnC,cAAc,EAAE,yBAAyB;aAC1C,CAAC,CAAC;YAEH,QAAQ,CAAC,GAAG,CAAC,2BACX,KAAK,CAAC,UAAU,SACd,OAAO,oBAAe,KAAK,CAAC,UAAU,SAAI,OAAO,UAAK,OAAO,CAAC,GAAG,oBAClE,IAAI,KAAK,CAAC,GAAG,CAAC,CAAC,IAAI,CAAC,GAAG,CAAC,SAAM,CAAC,CAAC;QACrC,CAAC,CAAC;IACJ,CAAC;IAfD,6BAeC","sourcesContent":["import { ErrorRequestHandler } from 'express';\nimport { HttpError } from 'http-errors';\nimport { STATUS_CODES } from 'http';\n\nexport default function finalError(): ErrorRequestHandler {\n return (error: HttpError, request, response, _) => {\n const message = error.expose\n ? error.message\n : STATUS_CODES[error.statusCode];\n\n response.writeHead(error.statusCode, {\n 'Content-Type': 'text/html;charset=utf-8'\n });\n\n response.end(`<!DOCTYPE html><title>${\n error.statusCode\n } ${message}</title><h1>${error.statusCode} ${message}: ${request.url}</h1>\n<!-- ${new Array(512).join('.')} -->`);\n };\n}\n"]} |