Fix broadcast channel payload cleanup for ATG
[e-mobility-charging-stations-simulator.git] / src / exception / BaseError.ts
index e1a82c001ac2718b99c12d15975278183157b223..1471844cf4cf109e0df3895061b586d6c6c510c2 100644 (file)
@@ -3,6 +3,10 @@ export default class BaseError extends Error {
     super(message);
     this.name = new.target.name;
     Object.setPrototypeOf(this, new.target.prototype);
-    Error.captureStackTrace ? (Error.captureStackTrace(this, this.constructor)) : (this.stack = (new Error()).stack);
+    Error.captureStackTrace ? Error.captureStackTrace(this, this.constructor) : this.createStack();
+  }
+
+  private createStack(): void {
+    this.stack = new Error().stack;
   }
 }