From e845f4105aa4a8d72109794115c456acda9d17b0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Florian=20M=C3=BCllner?= <fmuellner@gnome.org> Date: Thu, 18 May 2017 00:03:28 +0200 Subject: 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 --- js/ui/extensionSystem.js | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/js/ui/extensionSystem.js b/js/ui/extensionSystem.js index f25d63a..cf501da 100644 --- a/js/ui/extensionSystem.js +++ b/js/ui/extensionSystem.js @@ -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; -- cgit v0.12