fix: ensure graceful shutdown waits only for started stations stopping
[e-mobility-charging-stations-simulator.git] / src / exception / BaseError.ts
index 84421eac143b3db6440fd74cb2c8fc6ed8ec3eee..6b9ea70fd914de381f4bf90a82abd9778dc8c9fd 100644 (file)
@@ -1,12 +1,14 @@
 export class BaseError extends Error {
-  public constructor(message?: string) {
-    super(message);
-    this.name = new.target.name;
-    Object.setPrototypeOf(this, new.target.prototype);
-    Error.captureStackTrace ? Error.captureStackTrace(this, this.constructor) : this.createStack();
+  public constructor (message?: string) {
+    super(message)
+    this.name = new.target.name
+    Object.setPrototypeOf(this, new.target.prototype)
+    typeof Error.captureStackTrace === 'function'
+      ? Error.captureStackTrace(this, this.constructor)
+      : this.createStack()
   }
 
-  private createStack(): void {
-    this.stack = new Error().stack;
+  private createStack (): void {
+    this.stack = new Error().stack
   }
 }