Skip to content

Commit 249db38

Browse files
committed
test: remove unreachable code
There is no way a line can be called after throwing an exception.
1 parent 057126a commit 249db38

6 files changed

+1
-8
lines changed

test/message/throw_custom_error.js

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,5 +6,3 @@ console.error('before');
66

77
// custom error throwing
88
throw ({ name: 'MyCustomError', message: 'This is a custom message' });
9-
10-
console.error('after');

test/message/throw_non_error.js

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,5 +6,3 @@ console.error('before');
66

77
// custom error throwing
88
throw ({ foo: 'bar' });
9-
10-
console.error('after');

test/parallel/test-domain.js

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -163,7 +163,6 @@ expectCaught++;
163163
// as a callback instead.
164164
function fn(er) {
165165
throw new Error('This function should never be called!');
166-
process.exit(1);
167166
}
168167

169168
var bound = d.intercept(fn);

test/parallel/test-file-write-stream.js

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,6 @@ file
2626
})
2727
.on('error', function(err) {
2828
throw err;
29-
console.error('error!', err.stack);
3029
})
3130
.on('drain', function() {
3231
console.error('drain!', callbacks.drain);

test/parallel/test-http-content-length.js

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,6 @@ var server = http.createServer(function(req, res) {
4040
break;
4141
default:
4242
throw new Error('Unreachable');
43-
break;
4443
}
4544

4645
receivedRequests++;

test/parallel/test-listen-fd-detached-inherit.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -64,8 +64,8 @@ function test() {
6464
// Then output the child's pid, and immediately exit.
6565
function parent() {
6666
var server = net.createServer(function(conn) {
67-
throw new Error('Should not see connections on parent');
6867
conn.end('HTTP/1.1 403 Forbidden\r\n\r\nI got problems.\r\n');
68+
throw new Error('Should not see connections on parent');
6969
}).listen(PORT, function() {
7070
console.error('server listening on %d', PORT);
7171

0 commit comments

Comments
 (0)