extensions: Consistently handle createExtensionObject() errors

The method may throw an error, for example when metadata.json is
missing or cannot be parsed, however we are currently not always
handling it.

https://bugzilla.gnome.org/show_bug.cgi?id=781728
This commit is contained in:
Florian Müllner
2017-05-17 23:51:49 +02:00
parent 8d6efde091
commit 88b1a5d3a0
2 changed files with 13 additions and 5 deletions

View File

@ -199,7 +199,14 @@ function reloadExtension(oldExtension) {
unloadExtension(oldExtension);
// Now, recreate the extension and load it.
let newExtension = ExtensionUtils.createExtensionObject(uuid, dir, type);
let newExtension;
try {
newExtension = ExtensionUtils.createExtensionObject(uuid, dir, type);
} catch(e) {
logExtensionError(uuid, e);
return;
}
loadExtension(newExtension);
}