import {Response} from 'express'; import {Guid} from 'guid-typescript'; import logger from '../../middleware/logger.js'; /** * Same catch-block convention as the feedback and tickets modules: log with a * reference guid, never hand the real error message to the client. */ export const sendServerError = (res: Response, e: any): void => { const errorGuid = Guid.create().toString(); logger.error('Error handling a request: ' + e.message, {reference: errorGuid}); res.status(500).send({ status: 'PROCESSING_ERROR', message: 'Internal Server Error. Try again later.', reference: errorGuid }); };