Browse Source

Revert "Fix 'uncaughtException' for top level exceptions"

This reverts commit 8f8dcf8ed6.
v0.7.4-release
Ryan Dahl 15 years ago
parent
commit
8a52fb7aeb
  1. 6
      lib/module.js
  2. 3
      src/node.cc
  3. 2
      src/node.js
  4. 8
      test/simple/test-error-reporting.js
  5. 13
      test/simple/test-uncaught-exception.js

6
lib/module.js

@ -437,11 +437,9 @@ Module.prototype._waitChildrenLoad = function (callback) {
// bootstrap main module. // bootstrap main module.
exports.runMain = function (filename) { exports.runMain = function () {
// Load the main module--the command line argument. // Load the main module--the command line argument.
process.mainModule = new Module("."); process.mainModule = new Module(".");
process.mainModule.load(filename, function (err) { process.mainModule.loadSync(process.argv[1]);
if (err) throw err;
});
} }

3
src/node.cc

@ -1806,7 +1806,8 @@ static void Load(int argc, char *argv[]) {
f->Call(global, 1, args); f->Call(global, 1, args);
if (try_catch.HasCaught()) { if (try_catch.HasCaught()) {
FatalException(try_catch); ReportException(try_catch, true);
exit(11);
} }
} }

2
src/node.js

@ -239,7 +239,7 @@ if (process.argv[1]) {
process.argv[1] = path.join(cwd, process.argv[1]); process.argv[1] = path.join(cwd, process.argv[1]);
} }
module.runMain(process.argv[1]); module.runMain();
} else { } else {
// No arguments, run the repl // No arguments, run the repl
var repl = module.requireNative('repl'); var repl = module.requireNative('repl');

8
test/simple/test-error-reporting.js

@ -33,14 +33,14 @@ errExec('throws_error.js', function (err, stdout, stderr) {
}); });
// Trying to JSON.parse(undefined) in nextTick // Trying to JSON.parse(undefined)
errExec('throws_error3.js', function (err, stdout, stderr) { errExec('throws_error2.js', function (err, stdout, stderr) {
assert.ok(/JSON/.test(stderr)); assert.ok(/JSON/.test(stderr));
}); });
// Trying to JSON.parse(undefined) // Trying to JSON.parse(undefined) in nextTick
errExec('throws_error2.js', function (err, stdout, stderr) { errExec('throws_error3.js', function (err, stdout, stderr) {
assert.ok(/JSON/.test(stderr)); assert.ok(/JSON/.test(stderr));
}); });

13
test/simple/test-uncaught-exception.js

@ -1,13 +0,0 @@
require('../common')
process.addListener('uncaughtException', function (err) {
puts('Caught exception: ' + err);
});
setTimeout(function () {
puts('This will still run.');
}, 500);
// Intentionally cause an exception, but don't catch it.
nonexistentFunc();
puts('This will not run.');
Loading…
Cancel
Save