There is no way a line can be called after throwing an exception.
PR-URL: https://github.com/nodejs/node/pull/2289
Reviewed-By: Sakthipriyan Vairamani <thechargingvolcano@gmail.com>
Reviewed-By: Roman Reiss <me@silverwind.io>
Reviewed-By: Brendan Ashworth <brendan.ashworth@me.com>
var common = require('../common');
var assert = require('assert');
-console.error('before');
-
// custom error throwing
throw ({ name: 'MyCustomError', message: 'This is a custom message' });
-
-console.error('after');
-before
-*test*message*throw_custom_error.js:8
+*test*message*throw_custom_error.js:6
throw ({ name: 'MyCustomError', message: 'This is a custom message' });
^
MyCustomError: This is a custom message
var common = require('../common');
var assert = require('assert');
-console.error('before');
-
// custom error throwing
throw ({ foo: 'bar' });
-
-console.error('after');
-before
-*test*message*throw_non_error.js:8
+*test*message*throw_non_error.js:6
throw ({ foo: 'bar' });
^
[object Object]
// as a callback instead.
function fn(er) {
throw new Error('This function should never be called!');
- process.exit(1);
}
var bound = d.intercept(fn);
})
.on('error', function(err) {
throw err;
- console.error('error!', err.stack);
})
.on('drain', function() {
console.error('drain!', callbacks.drain);
break;
default:
throw new Error('Unreachable');
- break;
}
receivedRequests++;
// Then output the child's pid, and immediately exit.
function parent() {
var server = net.createServer(function(conn) {
- throw new Error('Should not see connections on parent');
conn.end('HTTP/1.1 403 Forbidden\r\n\r\nI got problems.\r\n');
+ throw new Error('Should not see connections on parent');
}).listen(PORT, function() {
console.error('server listening on %d', PORT);