Skip to content

Commit 8a52fb7

Browse files
committed
Revert "Fix 'uncaughtException' for top level exceptions"
This reverts commit 8f8dcf8.
1 parent 8f8dcf8 commit 8a52fb7

5 files changed

Lines changed: 10 additions & 24 deletions

File tree

lib/module.js

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -437,11 +437,9 @@ Module.prototype._waitChildrenLoad = function (callback) {
437437

438438

439439
// bootstrap main module.
440-
exports.runMain = function (filename) {
440+
exports.runMain = function () {
441441

442442
// Load the main module--the command line argument.
443443
process.mainModule = new Module(".");
444-
process.mainModule.load(filename, function (err) {
445-
if (err) throw err;
446-
});
444+
process.mainModule.loadSync(process.argv[1]);
447445
}

src/node.cc

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1805,8 +1805,9 @@ static void Load(int argc, char *argv[]) {
18051805

18061806
f->Call(global, 1, args);
18071807

1808-
if (try_catch.HasCaught()) {
1809-
FatalException(try_catch);
1808+
if (try_catch.HasCaught()) {
1809+
ReportException(try_catch, true);
1810+
exit(11);
18101811
}
18111812
}
18121813

src/node.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -239,7 +239,7 @@ if (process.argv[1]) {
239239
process.argv[1] = path.join(cwd, process.argv[1]);
240240
}
241241

242-
module.runMain(process.argv[1]);
242+
module.runMain();
243243
} else {
244244
// No arguments, run the repl
245245
var repl = module.requireNative('repl');

test/simple/test-error-reporting.js

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -33,14 +33,14 @@ errExec('throws_error.js', function (err, stdout, stderr) {
3333
});
3434

3535

36-
// Trying to JSON.parse(undefined) in nextTick
37-
errExec('throws_error3.js', function (err, stdout, stderr) {
36+
// Trying to JSON.parse(undefined)
37+
errExec('throws_error2.js', function (err, stdout, stderr) {
3838
assert.ok(/JSON/.test(stderr));
3939
});
4040

4141

42-
// Trying to JSON.parse(undefined)
43-
errExec('throws_error2.js', function (err, stdout, stderr) {
42+
// Trying to JSON.parse(undefined) in nextTick
43+
errExec('throws_error3.js', function (err, stdout, stderr) {
4444
assert.ok(/JSON/.test(stderr));
4545
});
4646

test/simple/test-uncaught-exception.js

Lines changed: 0 additions & 13 deletions
This file was deleted.

0 commit comments

Comments
 (0)