From 16de0098099dbf48cdfa85146a9f9cc9bfca778a Mon Sep 17 00:00:00 2001 From: Austin Golding Date: Thu, 1 Dec 2022 16:37:30 -0800 Subject: [PATCH] Add error message to http server close Closes #50 --- applications/server/src/machines/server.machine.ts | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/applications/server/src/machines/server.machine.ts b/applications/server/src/machines/server.machine.ts index f2e6fd0f..0d0c379e 100644 --- a/applications/server/src/machines/server.machine.ts +++ b/applications/server/src/machines/server.machine.ts @@ -108,12 +108,13 @@ const serverMachine = createMachine( let anonymizedPath = path.join(getDbPath(ctx.config.databaseMode), 'anonymized-campaigns'); if (existsSync(anonymizedPath)) rmSync(anonymizedPath, { recursive: true }); ctx.messagingService?.stop?.(); - ctx.server.close(() => { - console.info('HTTP server closed'); + ctx.server.close((err) => { + if (err) console.error('HTTP server closed', err); + else console.info('HTTP server closed'); process.exit(); }); - } catch { - console.info('HTTP server closed'); + } catch (err) { + console.error('HTTP server closed', err); process.exit(); } },