refactor: use helper to check charging station at WS opening
[e-mobility-charging-stations-simulator.git] / src / charging-station / Bootstrap.ts
index 16a590a9a493193c9dd7d4ede7789b6f4c8a2cfa..27f4a6073c8c5159c1bfa2b134688e6d6027325a 100644 (file)
@@ -8,7 +8,7 @@ import { isMainThread } from 'node:worker_threads';
 import chalk from 'chalk';
 import { availableParallelism } from 'poolifier';
 
-import { waitChargingStationEvents } from './ChargingStationUtils';
+import { waitChargingStationEvents } from './Helpers';
 import type { AbstractUIServer } from './ui-server/AbstractUIServer';
 import { UIServerFactory } from './ui-server/UIServerFactory';
 import { version } from '../../package.json' assert { type: 'json' };
@@ -109,7 +109,7 @@ export class Bootstrap extends EventEmitter {
 
   public async start(): Promise<void> {
     if (!isMainThread) {
-      throw new Error('Cannot start charging stations simulator from worker thread');
+      throw new BaseError('Cannot start charging stations simulator from worker thread');
     }
     if (this.started === false) {
       if (this.starting === false) {
@@ -176,7 +176,7 @@ export class Bootstrap extends EventEmitter {
 
   public async stop(): Promise<void> {
     if (!isMainThread) {
-      throw new Error('Cannot stop charging stations simulator from worker thread');
+      throw new BaseError('Cannot stop charging stations simulator from worker thread');
     }
     if (this.started === true) {
       if (this.stopping === false) {