From e4cb2c14d14e95090cca15518594af1c3f369d2b Mon Sep 17 00:00:00 2001 From: =?utf8?q?J=C3=A9r=C3=B4me=20Benoit?= Date: Wed, 24 Aug 2022 22:36:24 +0200 Subject: [PATCH] Fix exit conditions at startup MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit Signed-off-by: Jérôme Benoit --- src/charging-station/Bootstrap.ts | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/charging-station/Bootstrap.ts b/src/charging-station/Bootstrap.ts index 2bc650cc..80e14d15 100644 --- a/src/charging-station/Bootstrap.ts +++ b/src/charging-station/Bootstrap.ts @@ -32,6 +32,9 @@ import UIServerFactory from './ui-server/UIServerFactory'; const moduleName = 'Bootstrap'; +const missingChargingStationsConfigurationExitCode = 1; +const noChargingStationTemplatesExitCode = 2; + export default class Bootstrap { private static instance: Bootstrap | null = null; private workerImplementation: WorkerAbstract | null = null; @@ -105,12 +108,13 @@ export default class Bootstrap { console.warn( chalk.yellow("'stationTemplateUrls' not defined or empty in configuration, exiting") ); + process.exit(missingChargingStationsConfigurationExitCode); } if (this.numberOfChargingStations === 0) { console.warn( chalk.yellow('No charging station template enabled in configuration, exiting') ); - process.exit(); + process.exit(noChargingStationTemplatesExitCode); } else { console.info( chalk.green( -- 2.34.1