Skip to content

Commit 3ca483f

Browse files
Trottitaloacasas
authored andcommitted
test: throw Error objects instead of literals
test-tls-econnreset and test-http-response-status-message throw literals instead of Error objects. Use common.fail() which throws an AssertionError. PR-URL: #11168 Reviewed-By: James M Snell <[email protected]> Reviewed-By: Teddy Katz <[email protected]> Reviewed-By: Colin Ihrig <[email protected]> Reviewed-By: Michaël Zasso <[email protected]> Reviewed-By: Roman Reiss <[email protected]> Reviewed-By: Sakthipriyan Vairamani <[email protected]>
1 parent abae264 commit 3ca483f

File tree

2 files changed

+4
-4
lines changed

2 files changed

+4
-4
lines changed

test/parallel/test-http-response-status-message.js

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
'use strict';
2-
require('../common');
2+
const common = require('../common');
33
const assert = require('assert');
44
const http = require('http');
55
const net = require('net');
@@ -23,7 +23,7 @@ testCases.findByPath = function(path) {
2323
return testCase.path === path;
2424
});
2525
if (matching.length === 0) {
26-
throw 'failed to find test case with path ' + path;
26+
common.fail(`failed to find test case with path ${path}`);
2727
}
2828
return matching[0];
2929
};

test/parallel/test-tls-econnreset.js

+2-2
Original file line numberDiff line numberDiff line change
@@ -49,8 +49,8 @@ const ca = [ cert, cacert ];
4949
let clientError = null;
5050
let connectError = null;
5151

52-
const server = tls.createServer({ ca: ca, cert: cert, key: key }, (conn) => {
53-
throw 'unreachable';
52+
const server = tls.createServer({ ca: ca, cert: cert, key: key }, () => {
53+
common.fail('should be unreachable');
5454
}).on('tlsClientError', function(err, conn) {
5555
assert(!clientError && conn);
5656
clientError = err;

0 commit comments

Comments
 (0)