extensionSystem: Handle all initExtension() extension errors

The method currently catches errors that occur when calling the
extension's init() method, but throws itself an error if the
expected extension.js file is missing. The former is pointless
if we expect all callers to handle errors themselves anyway, and
we should avoid the latter if we don't - opt for the second option
and handle a missing extension.js file gracefully.

https://bugzilla.gnome.org/show_bug.cgi?id=781728
This commit is contained in:
Florian Müllner 2017-05-18 00:03:28 +02:00
parent d461d02cdc
commit e845f4105a

View File

@ -218,8 +218,10 @@ function initExtension(uuid) {
throw new Error("Extension was not properly created. Call loadExtension first");
let extensionJs = dir.get_child('extension.js');
if (!extensionJs.query_exists(null))
throw new Error('Missing extension.js');
if (!extensionJs.query_exists(null)) {
logExtensionError(uuid, new Error('Missing extension.js'));
return false;
}
let extensionModule;
let extensionState = null;