refactor(simulator): move main process unhandled or uncaught error
[e-mobility-charging-stations-simulator.git] / src / charging-station / Bootstrap.ts
index 2bf7159539988aca847ea9d60539542dc65ddbab..b14952436e4c6a3ddd008760897301c5d80b4e62 100644 (file)
@@ -51,6 +51,9 @@ export class Bootstrap {
   private constructor() {
     this.started = false;
     this.workerImplementation = null;
+    // Enable unconditionally for now
+    this.logUnhandledRejection();
+    this.logUncaughtException();
     this.workerScript = path.join(
       path.resolve(path.dirname(fileURLToPath(import.meta.url)), '../'),
       'charging-station',
@@ -78,9 +81,6 @@ export class Bootstrap {
   public async start(): Promise<void> {
     if (isMainThread && this.started === false) {
       try {
-        // Enable unconditionally for now
-        this.logUnhandledRejection();
-        this.logUncaughtException();
         this.initializeCounters();
         this.initializeWorkerImplementation();
         await this.storage?.open();