UNPKG

@ministryofjustice/hmpps-digital-prison-reporting-frontend

Version:

The Digital Prison Reporting Frontend contains templates and code to help display data effectively in UI applications.

26 lines (23 loc) 887 B
import { ErrorHandler } from '../../../utils/ErrorHandler/ErrorHandler.js'; import { captureDprError } from '../../../utils/captureError.js'; class ViewReportController { layoutPath; services; constructor(layoutPath, services) { this.layoutPath = layoutPath; this.services = services; } errorHandler = async (error, req, res, _next) => { captureDprError(error, `Error: ${JSON.stringify(req.body)}`); const formattedErr = new 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, }); }; } export { ViewReportController, ViewReportController as default }; //# sourceMappingURL=controller.js.map