Skip to content

Commit 2652490

Browse files
author
Robert Jackson
authored
Ensure logging of modules that failed to gather telemetry. (#130)
Ensure logging of modules that failed to gather telemetry.
2 parents 94a469a + a281425 commit 2652490

1 file changed

Lines changed: 7 additions & 1 deletion

File tree

lib/gather-telemetry.js

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,10 @@ module.exports = async function gatherTelemetry(url) {
77

88
await page.goto(url);
99

10+
await page.exposeFunction("logErrorInNodeProcess", message => {
11+
console.error(message); // eslint-disable-line no-console
12+
});
13+
1014
// Get the "viewport" of the page, as reported by the page.
1115
const telemetry = await page.evaluate(() => {
1216
const SKIPPED_MODULES = ["fetch/ajax"];
@@ -31,7 +35,9 @@ module.exports = async function gatherTelemetry(url) {
3135
}
3236
} catch (error) {
3337
// log the error, but continue
34-
console.error(`error evaluating \`${modulePath}\`: ${error.message}`); // eslint-disable-line no-console
38+
window.logErrorInNodeProcess(
39+
`error evaluating \`${modulePath}\`: ${error.message}`
40+
);
3541
}
3642
}
3743

0 commit comments

Comments
 (0)