Skip to content

Commit 073d9c5

Browse files
author
Robert Jackson
committed
Handle module failures gracefully while gathering telemetry.
1 parent cf3077f commit 073d9c5

File tree

3 files changed

+12
-3
lines changed

3 files changed

+12
-3
lines changed

lib/gather-telemetry.js

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -17,10 +17,17 @@ module.exports = async function gatherTelemetry(url) {
1717
for (let modulePath of modules) {
1818
let module = require(modulePath);
1919

20-
if (module && module.default && module.default.proto) {
21-
let defaultProto = module.default.proto();
20+
try {
21+
let module = require(modulePath);
2222

23-
telemetry[modulePath] = parseMeta(Ember.meta(defaultProto));
23+
if (module && module.default && module.default.proto) {
24+
let defaultProto = module.default.proto();
25+
26+
telemetry[modulePath] = parseMeta(Ember.meta(defaultProto));
27+
}
28+
} catch (error) {
29+
// log the error, but continue
30+
console.error(`error evaluating \`${modulePath}\`: ${error.message}`); // eslint-disable-line no-console
2431
}
2532
}
2633

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
throw new Error('This should not fail the telemetry gathering!');
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
throw new Error('This should not fail the telemetry gathering!');

0 commit comments

Comments
 (0)