'use strict';

Object.defineProperty(exports, '__esModule', { value: true });

var node = require('@sentry/node');
var ErrorHandler = require('../../../utils/ErrorHandler/ErrorHandler.js');
var logger = require('../../../utils/logger.js');

class ViewReportController {
    layoutPath;
    services;
    constructor(layoutPath, services) {
        this.layoutPath = layoutPath;
        this.services = services;
    }
    errorHandler = async (error, req, res, _next) => {
        logger.default.error(`Error: ${JSON.stringify(req.body)}`);
        const formattedErr = new ErrorHandler.ErrorHandler(error || {}).formatError();
        node.captureException(error);
        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
