Skip to content

Commit

Permalink
fix: add more helpful error messages when fMP is missing (#1959)
Browse files Browse the repository at this point in the history
  • Loading branch information
patrickhulce authored and brendankenny committed Apr 4, 2017
1 parent 2d330c8 commit 0bf1744
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 0 deletions.
3 changes: 3 additions & 0 deletions lighthouse-core/audits/estimated-input-latency.js
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,9 @@ class EstimatedInputLatency extends Audit {

static calculate(tabTrace, model, trace) {
const startTime = tabTrace.timings.firstMeaningfulPaint;
if (!startTime) {
throw new Error('No firstMeaningfulPaint event found in trace');
}

const latencyPercentiles = TracingProcessor.getRiskToResponsiveness(model, trace, startTime);
const ninetieth = latencyPercentiles.find(result => result.percentile === 0.9);
Expand Down
4 changes: 4 additions & 0 deletions lighthouse-core/audits/time-to-interactive.js
Original file line number Diff line number Diff line change
Expand Up @@ -170,6 +170,10 @@ class TTIMetric extends Audit {
const fMPtsInMS = tabTrace.timestamps.firstMeaningfulPaint;
const navStartTsInMS = tabTrace.timestamps.navigationStart;

if (!fMPtsInMS) {
throw new Error('No firstMeaningfulPaint event found in trace');
}

const fmpTiming = tabTrace.timings.firstMeaningfulPaint;
const traceEndTiming = tabTrace.timings.traceEnd;

Expand Down

0 comments on commit 0bf1744

Please sign in to comment.