fix: ignore harmless performance error at shutdown
[e-mobility-charging-stations-simulator.git] / src / performance / PerformanceStatistics.ts
index b7bc5d27f894c27c9984571e90a4b07187ed8fed..94c189e4d3e6251a7bf8bfa7022a13b1fc4d07f7 100644 (file)
@@ -78,7 +78,15 @@ export class PerformanceStatistics {
   }
 
   public static endMeasure(name: string, markId: string): void {
-    performance.measure(name, markId);
+    try {
+      performance.measure(name, markId);
+    } catch (error) {
+      if (error instanceof Error && error.message.includes('performance mark has not been set')) {
+        /** Ignore */
+      } else {
+        throw error;
+      }
+    }
     performance.clearMarks(markId);
     performance.clearMeasures(name);
   }