Unverified Commit 9eba7517 authored by Louis-Philippe Carignan's avatar Louis-Philippe Carignan Committed by GitHub

Update core.js

Added more log info when loading plugins and we are waiting for dependencies to load. The .catch part will now log the error so we can better debug the problem.
parent 936c926e
......@@ -107,20 +107,24 @@ CMBF.prototype.waitFor = function(deps, options) {
return entry.resolver.promise;
});
_this.log.debug("Plugin %s is waiting for deps ", options.debug, deps);
_this.log.info("Plugin %s is waiting for %s [Timeout: %s ms] ", options.debug, printDependencies(deps), options.timeout);
return P.all(depsResolvers).timeout(options.timeout).then(function() {
_this.log.info("All dependencies for plugin %s were successfully loaded", options.debug);
}).catch(function() {
_this.log.error("Unable to load plugin %s. Was waiting for deps", options.debug, deps);
_this.log.error("Dumping plugin state for easier debugging");
_.each(_this.plugins, function(plugin) {
_this.log.error("Plugin %s: ", plugin.plugin.register.attributes.pkg.name, plugin.resolver.promise._settledValue);
});
}).catch(function(error) {
_this.log.error("Unable to load plugin %s. Was waiting for deps %s [Error: %s]", options.debug, printDependencies(deps), error);
});
};
function printDependencies(deps){
if (_.isEmpty(deps))
return '0 plugins';
else
return _.reduce(deps, function(item) {
return item + ", ";
});
}
CMBF.prototype.installPlugin = P.method(function(plugin, options) {
var _this = this;
options = options || {};
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment