diff --git a/server/server.ts b/server/server.ts index 2df32aef39..ab8d241999 100644 --- a/server/server.ts +++ b/server/server.ts @@ -406,22 +406,20 @@ function forceNoCacheRequest(_req: Request, res: Response, next: NextFunction) { function indexRequest(_req: Request, res: Response) { res.setHeader("Content-Type", "text/html"); - return fs.readFile( - Utils.getFileFromRelativeToRoot("client/index.html.tpl"), - "utf-8", - (err, file) => { - if (err) { - throw err; - } + fs.readFile(Utils.getFileFromRelativeToRoot("client/index.html.tpl"), "utf-8", (err, file) => { + if (err) { + log.error(`failed to server index request: ${err.name}, ${err.message}`); + res.sendStatus(500); + return; + } - const config: IndexTemplateConfiguration = { - ...getServerConfiguration(), - ...{cacheBust: Helper.getVersionCacheBust()}, - }; + const config: IndexTemplateConfiguration = { + ...getServerConfiguration(), + ...{cacheBust: Helper.getVersionCacheBust()}, + }; - res.send(_.template(file)(config)); - } - ); + res.send(_.template(file)(config)); + }); } function initializeClient(