This commit is contained in:
parent
b00a37eb17
commit
e08cd70eef
|
@ -5,6 +5,8 @@
|
||||||
import express, {Request, Response} from 'express';
|
import express, {Request, Response} from 'express';
|
||||||
import * as EventService from './events.service';
|
import * as EventService from './events.service';
|
||||||
import * as iCalService from './icalgenerator.service';
|
import * as iCalService from './icalgenerator.service';
|
||||||
|
import {Guid} from 'guid-typescript';
|
||||||
|
import logger from '../../../middleware/logger';
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -23,7 +25,6 @@ const fileNames = ['Nachklang_calendar', 'Nachklang_internal_calendar', 'Nachkla
|
||||||
* Controller Definitions
|
* Controller Definitions
|
||||||
*/
|
*/
|
||||||
|
|
||||||
// POST users/register
|
|
||||||
eventsRouter.get('/json', async (req: Request, res: Response) => {
|
eventsRouter.get('/json', async (req: Request, res: Response) => {
|
||||||
try {
|
try {
|
||||||
// Get request params
|
// Get request params
|
||||||
|
@ -56,7 +57,12 @@ eventsRouter.get('/ical', async (req: Request, res: Response) => {
|
||||||
res.set({'Content-Disposition': 'attachment; filename=' + fileName + '.ics'});
|
res.set({'Content-Disposition': 'attachment; filename=' + fileName + '.ics'});
|
||||||
res.status(200).send(file);
|
res.status(200).send(file);
|
||||||
} catch (e: any) {
|
} catch (e: any) {
|
||||||
console.log('Error handling a request: ' + e.message);
|
let errorGuid = Guid.create().toString();
|
||||||
res.status(500).send(JSON.stringify({'message': 'Internal Server Error. Try again later.'}));
|
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
|
||||||
|
});
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
Loading…
Reference in New Issue
Block a user