Skip to content
This repository was archived by the owner on Sep 12, 2019. It is now read-only.

Commit 67886c3

Browse files
author
sw-yx
committed
move readme and robustify detector reading
1 parent b451258 commit 67886c3

File tree

2 files changed

+14
-1
lines changed

2 files changed

+14
-1
lines changed

src/detect-server.js

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,20 @@ const fs = require("fs");
1111
const detectors = fs
1212
.readdirSync(path.join(__dirname, "detectors"))
1313
.filter(x => x.endsWith(".js")) // only accept .js detector files
14-
.map(det => require(path.join(__dirname, `detectors/${det}`)));
14+
.map(det => {
15+
try {
16+
return require(path.join(__dirname, `detectors/${det}`));
17+
} catch (err) {
18+
console.error(
19+
`failed to load detector: ${chalk.yellow(
20+
det
21+
)}, this is likely a bug in the detector, please file an issue in netlify-dev-plugin`,
22+
err
23+
);
24+
return null;
25+
}
26+
})
27+
.filter(Boolean);
1528

1629
module.exports.serverSettings = async devConfig => {
1730
let settingsArr = [];

0 commit comments

Comments
 (0)