Apply dependencies update
[e-mobility-charging-stations-simulator.git] / src / worker / WorkerUtils.ts
index 7db9de9e70fb2170dde17d7fad41df7ac1047f8c..4d6868f76f35cf77166cfcff54c7e23ccae0036d 100644 (file)
@@ -1,7 +1,17 @@
+import chalk from 'chalk';
+
 export class WorkerUtils {
+  private constructor() {
+    // This is intentional
+  }
+
   public static defaultExitHandler = (code: number): void => {
     if (code !== 0) {
-      console.error(`Worker stopped with exit code ${code}`);
+      console.error(chalk.red(`Worker stopped with exit code ${code}`));
     }
   };
+
+  public static defaultErrorHandler = (error: Error): void => {
+    console.error(chalk.red('Worker errored: ', error));
+  };
 }