@ministryofjustice/hmpps-digital-prison-reporting-frontend
Version:
The Digital Prison Reporting Frontend contains templates and code to help display data effectively in UI applications.
31 lines (26 loc) • 1.01 kB
JavaScript
;
Object.defineProperty(exports, '__esModule', { value: true });
var ErrorHandler = require('../../../utils/ErrorHandler/ErrorHandler.js');
var captureError = require('../../../utils/captureError.js');
class ViewReportController {
layoutPath;
services;
constructor(layoutPath, services) {
this.layoutPath = layoutPath;
this.services = services;
}
errorHandler = async (error, req, res, _next) => {
captureError.captureDprError(error, `Error: ${JSON.stringify(req.body)}`);
const formattedErr = new ErrorHandler.ErrorHandler(error || {}).formatError();
res.render(`dpr/routes/journeys/view-report/error`, {
layoutPath: this.layoutPath,
...(req.body && { ...req.body }),
...req.params,
error: formattedErr,
params: req.params,
});
};
}
exports.ViewReportController = ViewReportController;
exports.default = ViewReportController;
//# sourceMappingURL=controller.js.map