Skip to content

Commit 18c0bf4

Browse files
authored
fix(ember): Add guards to ensure marks exist (#3436)
This adds some guards before performing the initial load performance.measure to ensure that the performance marks exist. If the marks don't exist an error is thrown.
1 parent a4226b8 commit 18c0bf4

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

packages/ember/addon/instance-initializers/sentry-performance.ts

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -305,6 +305,12 @@ function _instrumentInitialLoad(config: EmberSentryConfig) {
305305
}
306306
const measureName = '@sentry/ember:initial-load';
307307

308+
const startMarkExists = performance.getEntriesByName(startName).length > 0;
309+
const endMarkExists = performance.getEntriesByName(endName).length > 0;
310+
if (!startMarkExists || !endMarkExists) {
311+
return;
312+
}
313+
308314
performance.measure(measureName, startName, endName);
309315
const measures = performance.getEntriesByName(measureName);
310316
const measure = measures[0];

0 commit comments

Comments
 (0)