Skip to content

Commit

Permalink
test: throw Error objects instead of literals
Browse files Browse the repository at this point in the history
test-tls-econnreset and test-http-response-status-message throw literals
instead of Error objects. Use common.fail() which throws an
AssertionError.

PR-URL: nodejs#11168
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Teddy Katz <teddy.katz@gmail.com>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Michaël Zasso <targos@protonmail.com>
Reviewed-By: Roman Reiss <me@silverwind.io>
Reviewed-By: Sakthipriyan Vairamani <thechargingvolcano@gmail.com>
  • Loading branch information
Trott authored and italoacasas committed Feb 14, 2017
1 parent abae264 commit 3ca483f
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
4 changes: 2 additions & 2 deletions test/parallel/test-http-response-status-message.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
'use strict';
require('../common');
const common = require('../common');
const assert = require('assert');
const http = require('http');
const net = require('net');
Expand All @@ -23,7 +23,7 @@ testCases.findByPath = function(path) {
return testCase.path === path;
});
if (matching.length === 0) {
throw 'failed to find test case with path ' + path;
common.fail(`failed to find test case with path ${path}`);
}
return matching[0];
};
Expand Down
4 changes: 2 additions & 2 deletions test/parallel/test-tls-econnreset.js
Original file line number Diff line number Diff line change
Expand Up @@ -49,8 +49,8 @@ const ca = [ cert, cacert ];
let clientError = null;
let connectError = null;

const server = tls.createServer({ ca: ca, cert: cert, key: key }, (conn) => {
throw 'unreachable';
const server = tls.createServer({ ca: ca, cert: cert, key: key }, () => {
common.fail('should be unreachable');
}).on('tlsClientError', function(err, conn) {
assert(!clientError && conn);
clientError = err;
Expand Down

0 comments on commit 3ca483f

Please sign in to comment.