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:
commit
1066c1acaf
1 changed files with 9 additions and 1 deletions
|
@ -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)
|
||||
|
|
Loading…
Reference in a new issue