fix: ignore harmless performance error at shutdown
authorJérôme Benoit <jerome.benoit@sap.com>
Wed, 29 Nov 2023 10:08:43 +0000 (11:08 +0100)
committerJérôme Benoit <jerome.benoit@sap.com>
Wed, 29 Nov 2023 10:08:43 +0000 (11:08 +0100)
Signed-off-by: Jérôme Benoit <jerome.benoit@sap.com>
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);
   }