Apply dependencies update
[e-mobility-charging-stations-simulator.git] / src / worker / WorkerUtils.ts
index 3b90b6fb78cf301017ea746aa2fb47b7298b68e9..2b6123514633799c668060ff755e4d7a645394a7 100644 (file)
@@ -1,5 +1,3 @@
-import { threadId } from 'worker_threads';
-
 import chalk from 'chalk';
 
 export class WorkerUtils {
@@ -9,7 +7,11 @@ export class WorkerUtils {
 
   public static defaultExitHandler = (code: number): void => {
     if (code !== 0) {
-      console.error(chalk.red(`Worker ${threadId} stopped with exit code ${code}`));
+      console.error(chalk.red(`Worker exited with error exit code: ${code.toString()}`));
     }
   };
+
+  public static defaultErrorHandler = (error: Error): void => {
+    console.error(chalk.red('Worker errored: ', error));
+  };
 }