From e6f1ccc6814f7a19b8dd34842365e6b7bc0fe42a Mon Sep 17 00:00:00 2001 From: Peter Peterson Date: Mon, 13 Nov 2017 13:25:53 -0700 Subject: [PATCH] pass the error to the callback when trying to load additional plugins at runtime. --- architect.js | 30 +++++++++++++++++------------- 1 file changed, 17 insertions(+), 13 deletions(-) diff --git a/architect.js b/architect.js index 090b564..ef421cf 100644 --- a/architect.js +++ b/architect.js @@ -527,20 +527,24 @@ function Architect(config) { callback(null, app); }); // What about error state? - // Check the config - hopefully this works - var _sortedPlugins = checkConfig(additionalConfig, function(name){ - return services[name]; - }); - - if (ready) { - sortedPlugins = _sortedPlugins; - // Start Loading additional plugins - startPlugins(true); - } - else { - _sortedPlugins.forEach(function(item){ - sortedPlugins.push(item); + try { + // Check the config - hopefully this works + var _sortedPlugins = checkConfig(additionalConfig, function(name){ + return services[name]; }); + + if (ready) { + sortedPlugins = _sortedPlugins; + // Start Loading additional plugins + startPlugins(true); + } + else { + _sortedPlugins.forEach(function(item){ + sortedPlugins.push(item); + }); + } + } catch (err) { + callback(err, null); } }); }