Add warning when config parsing fails

Summary:
This can quite easily happen if you manually edit it and
aren't careful. The least we can do is tell the user about it,
because it be a bit surprising otherwise.

Reviewed By: jknoxville

Differential Revision: D17626760

fbshipit-source-id: 8c7d64b041fa4b97ce2753116800d0e855442dd9
This commit is contained in:
Pascal Hartig
2019-09-27 08:13:29 -07:00
committed by Facebook Github Bot
parent dda800c4a3
commit 4b60433425

View File

@@ -41,6 +41,8 @@ module.exports = function(argv) {
};
} catch (e) {
// file not readable or not parsable, overwrite it with the new config
console.warn(`Failed to read ${configPath}: ${e}`);
console.info('Writing new default config.');
fs.writeFileSync(configPath, JSON.stringify(config));
}