Merge pull request #5882 from electron/felix-extension-warning-2

Log a warning if an extension's manifest cannot be parsed
This commit is contained in:
Cheng Zhao 2016-06-06 06:20:02 +00:00 committed by GitHub
commit 1066c1acaf

View file

@ -20,7 +20,15 @@ const generateExtensionIdFromName = function (name) {
// Create or get manifest object from |srcDirectory|.
const getManifestFromPath = function (srcDirectory) {
const manifest = JSON.parse(fs.readFileSync(path.join(srcDirectory, 'manifest.json')))
let manifest
try {
manifest = JSON.parse(fs.readFileSync(path.join(srcDirectory, 'manifest.json')))
} catch (err) {
console.warn(`Attempted to load extension from ${srcDirectory}, but parsing the manifest failed.`)
console.warn('Error encountered:', err)
}
if (!manifestNameMap[manifest.name]) {
const extensionId = generateExtensionIdFromName(manifest.name)
console.log(extensionId)