Error message on bad module load.

pull/22966/head
Ryan Dahl 2009-09-28 17:12:28 +02:00
parent 23c7f472d0
commit 835554c92b
1 changed files with 5 additions and 2 deletions

View File

@ -148,6 +148,11 @@ node.Module.cache = {};
}
});
loadPromise.addErrback(function (e) {
node.stdio.writeError(e.message + "\n");
process.exit(1);
});
if (!parent) {
// root module
node.assert(requestedPath.charAt(0) == "/");
@ -202,7 +207,6 @@ node.Module.prototype.loadObject = function (loadPromise) {
loadPromise.emitSuccess(self.target);
} else {
loadPromise.emitError(new Error("Error reading " + self.filename));
process.exit(1);
}
});
};
@ -213,7 +217,6 @@ node.Module.prototype.loadScript = function (loadPromise) {
catPromise.addErrback(function () {
loadPromise.emitError(new Error("Error reading " + self.filename));
process.exit(1);
});
catPromise.addCallback(function (content) {