From 835554c92b85e78a13498a428041f29962caaf3c Mon Sep 17 00:00:00 2001 From: Ryan Dahl Date: Mon, 28 Sep 2009 17:12:28 +0200 Subject: [PATCH] Error message on bad module load. --- src/node.js | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/src/node.js b/src/node.js index 8922e2dfe7..bb55e3aec2 100644 --- a/src/node.js +++ b/src/node.js @@ -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) {