bf7be65b03
Jenkins Production Deployment
Reviewed-on: #12 Co-authored-by: Patrick Müller <mail@pmueller.me> Co-committed-by: Patrick Müller <mail@pmueller.me>
18 lines
608 B
TypeScript
18 lines
608 B
TypeScript
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
|
|
});
|
|
};
|