From 2d4bb56ffa55e59727c0a48a24c0ca2dc42fa9ce Mon Sep 17 00:00:00 2001 From: Simon Larsen Date: Wed, 4 Oct 2023 19:22:25 +0100 Subject: [PATCH] exit node process on app init fail --- Accounts/Serve.ts | 2 ++ AdminDashboard/Serve.ts | 2 ++ ApiReference/Index.ts | 2 ++ Dashboard/Serve.ts | 2 ++ DashboardAPI/Index.ts | 2 ++ File/Index.ts | 2 ++ Identity/Index.ts | 2 ++ LinkShortener/Index.ts | 2 ++ Notification/Index.ts | 2 ++ Probe/Index.ts | 2 ++ ProbeAPI/Index.ts | 2 ++ StatusPage/Serve.ts | 2 ++ TestServer/Index.ts | 2 ++ Workers/Index.ts | 2 ++ Workflow/Index.ts | 2 ++ 15 files changed, 30 insertions(+) diff --git a/Accounts/Serve.ts b/Accounts/Serve.ts index bded796593..2fd9bba83a 100755 --- a/Accounts/Serve.ts +++ b/Accounts/Serve.ts @@ -14,11 +14,13 @@ const init: () => Promise = async (): Promise => { } catch (err) { logger.error('App Init Failed:'); logger.error(err); + throw err; } }; init().catch((err: Error) => { logger.error(err); + logger.info('Exiting node process'); process.exit(1); }); diff --git a/AdminDashboard/Serve.ts b/AdminDashboard/Serve.ts index 4ce80126ce..126fe87cc3 100755 --- a/AdminDashboard/Serve.ts +++ b/AdminDashboard/Serve.ts @@ -13,11 +13,13 @@ const init: () => Promise = async (): Promise => { } catch (err) { logger.error('App Init Failed:'); logger.error(err); + throw err; } }; init().catch((err: Error) => { logger.error(err); + logger.info('Exiting node process'); process.exit(1); }); diff --git a/ApiReference/Index.ts b/ApiReference/Index.ts index ffb956c663..dca2747a43 100755 --- a/ApiReference/Index.ts +++ b/ApiReference/Index.ts @@ -93,11 +93,13 @@ const init: () => Promise = async (): Promise => { } catch (err) { logger.error('App Init Failed:'); logger.error(err); + throw err; } }; init().catch((err: Error) => { logger.error(err); + logger.info('Exiting node process'); process.exit(1); }); diff --git a/Dashboard/Serve.ts b/Dashboard/Serve.ts index c3d3775023..49e87c258f 100755 --- a/Dashboard/Serve.ts +++ b/Dashboard/Serve.ts @@ -13,11 +13,13 @@ const init: () => Promise = async (): Promise => { } catch (err) { logger.error('App Init Failed:'); logger.error(err); + throw err; } }; init().catch((err: Error) => { logger.error(err); + logger.info('Exiting node process'); process.exit(1); }); diff --git a/DashboardAPI/Index.ts b/DashboardAPI/Index.ts index 175ccd5baf..f399410d04 100755 --- a/DashboardAPI/Index.ts +++ b/DashboardAPI/Index.ts @@ -1019,10 +1019,12 @@ const init: () => Promise = async (): Promise => { } catch (err) { logger.error('App Init Failed:'); logger.error(err); + throw err; } }; init().catch((err: Error) => { logger.error(err); + logger.info('Exiting node process'); process.exit(1); }); diff --git a/File/Index.ts b/File/Index.ts index 465b553241..a3fc1b47c5 100644 --- a/File/Index.ts +++ b/File/Index.ts @@ -42,10 +42,12 @@ const init: () => Promise = async (): Promise => { } catch (err) { logger.error('App Init Failed:'); logger.error(err); + throw err; } }; init().catch((err: Error) => { logger.error(err); + logger.info('Exiting node process'); process.exit(1); }); diff --git a/Identity/Index.ts b/Identity/Index.ts index e8da10926b..6d0e6265e6 100644 --- a/Identity/Index.ts +++ b/Identity/Index.ts @@ -46,10 +46,12 @@ const init: () => Promise = async (): Promise => { } catch (err) { logger.error('App Init Failed:'); logger.error(err); + throw err; } }; init().catch((err: Error) => { logger.error(err); + logger.info('Exiting node process'); process.exit(1); }); diff --git a/LinkShortener/Index.ts b/LinkShortener/Index.ts index c0e38dd412..4822abe070 100644 --- a/LinkShortener/Index.ts +++ b/LinkShortener/Index.ts @@ -22,11 +22,13 @@ const init: () => Promise = async (): Promise => { } catch (err) { logger.error('App Init Failed:'); logger.error(err); + throw err; } }; init().catch((err: Error) => { logger.error(err); + logger.info('Exiting node process'); process.exit(1); }); diff --git a/Notification/Index.ts b/Notification/Index.ts index 31de57a692..45542eaad4 100644 --- a/Notification/Index.ts +++ b/Notification/Index.ts @@ -41,10 +41,12 @@ const init: () => Promise = async (): Promise => { } catch (err) { logger.error('App Init Failed:'); logger.error(err); + throw err; } }; init().catch((err: Error) => { logger.error(err); + logger.info('Exiting node process'); process.exit(1); }); diff --git a/Probe/Index.ts b/Probe/Index.ts index e2c86f8d26..d670957af3 100644 --- a/Probe/Index.ts +++ b/Probe/Index.ts @@ -49,10 +49,12 @@ const init: () => Promise = async (): Promise => { } catch (err) { logger.error('App Init Failed:'); logger.error(err); + throw err; } }; init().catch((err: Error) => { logger.error(err); + logger.info('Exiting node process'); process.exit(1); }); diff --git a/ProbeAPI/Index.ts b/ProbeAPI/Index.ts index 64d2322792..f69c813164 100644 --- a/ProbeAPI/Index.ts +++ b/ProbeAPI/Index.ts @@ -40,10 +40,12 @@ const init: () => Promise = async (): Promise => { } catch (err) { logger.error('App Init Failed:'); logger.error(err); + throw err; } }; init().catch((err: Error) => { logger.error(err); + logger.info('Exiting node process'); process.exit(1); }); diff --git a/StatusPage/Serve.ts b/StatusPage/Serve.ts index c88062d030..dd191db9b0 100644 --- a/StatusPage/Serve.ts +++ b/StatusPage/Serve.ts @@ -18,11 +18,13 @@ const init: () => Promise = async (): Promise => { } catch (err) { logger.error('App Init Failed:'); logger.error(err); + throw err; } }; init().catch((err: Error) => { logger.error(err); + logger.info('Exiting node process'); process.exit(1); }); diff --git a/TestServer/Index.ts b/TestServer/Index.ts index 54dbf6bdd5..c5bc9a3db2 100644 --- a/TestServer/Index.ts +++ b/TestServer/Index.ts @@ -19,10 +19,12 @@ const init: () => Promise = async (): Promise => { } catch (err) { logger.error('App Init Failed:'); logger.error(err); + throw err; } }; init().catch((err: Error) => { logger.error(err); + logger.info('Exiting node process'); process.exit(1); }); diff --git a/Workers/Index.ts b/Workers/Index.ts index 7cf4516825..9a5497cffe 100644 --- a/Workers/Index.ts +++ b/Workers/Index.ts @@ -121,10 +121,12 @@ const init: () => Promise = async (): Promise => { } catch (err) { logger.error('App Init Failed:'); logger.error(err); + throw err; } }; init().catch((err: Error) => { logger.error(err); + logger.info('Exiting node process'); process.exit(1); }); diff --git a/Workflow/Index.ts b/Workflow/Index.ts index a8e6972b47..e006f35f6b 100644 --- a/Workflow/Index.ts +++ b/Workflow/Index.ts @@ -73,11 +73,13 @@ const init: () => Promise = async (): Promise => { } catch (err) { logger.error('App Init Failed:'); logger.error(err); + throw err; } }; init().catch((err: Error) => { logger.error(err); + logger.info('Exiting node process'); process.exit(1); });