Catch MODULE_NOT_FOUND errors, throw others

This commit is contained in:
Andrew Stewart 2014-04-01 10:30:14 -07:00
parent a92e51157f
commit 2563e62de4
1 changed files with 10 additions and 2 deletions

View File

@ -296,7 +296,11 @@ namespace("Cylon", function() {
try {
return this.adaptors[adaptorName] = require(moduleName);
} catch (e) {
this._missingModuleError(moduleName);
if (e.code === "MODULE_NOT_FOUND") {
this._missingModuleError(moduleName);
} else {
throw e;
}
}
}
};
@ -354,7 +358,11 @@ namespace("Cylon", function() {
try {
return this.drivers[driverName] = require(moduleName);
} catch (e) {
this._missingModuleError(moduleName);
if (e.code === "MODULE_NOT_FOUND") {
this._missingModuleError(moduleName);
} else {
throw e;
}
}
}
};