remove unecessary code from module loading, fix [#432]

This commit is contained in:
reality 2013-05-06 15:36:35 +00:00
parent ae22060fcb
commit 090f15e738

15
run.js
View File

@ -157,7 +157,6 @@ DBot.prototype.reloadModules = function() {
var name, moduleDir, config; var name, moduleDir, config;
for(i=0;i<moduleNames.length;i++) { for(i=0;i<moduleNames.length;i++) {
name = moduleNames[i]; name = moduleNames[i];
console.log('iterating ' + name);
this.status[name] = true; this.status[name] = true;
moduleDir = './modules/' + name + '/'; moduleDir = './modules/' + name + '/';
try { try {
@ -165,14 +164,7 @@ DBot.prototype.reloadModules = function() {
delete require.cache[cacheKey]; delete require.cache[cacheKey];
} catch(err) { } catch(err) {
this.status[name] = 'Error loading module: ' + err + ' ' + err.stack.split('\n')[2].trim(); this.status[name] = 'Error loading module: ' + err + ' ' + err.stack.split('\n')[2].trim();
return; continue;
}
try {
var webKey = require.resolve(moduleDir + 'web');
} catch(err) { }
if(webKey) {
delete require.cache[webKey];
} }
// Load the module config data // Load the module config data
@ -228,7 +220,10 @@ DBot.prototype.reloadModules = function() {
var module = rawModule.fetch(this); var module = rawModule.fetch(this);
this.rawModules.push(rawModule); this.rawModules.push(rawModule);
} catch(err) { } catch(err) {
console.log(err); var stack = err.stack.split('\n')[2].trim();
this.status[name] = 'Error loading module: ' + err + ' ' + stack;
console.log('Error loading module: ' + err + ' ' + stack);
return;
} }
module.name = name; module.name = name;