From 3ca483f4cc3bf8ea934f5079c22228ed24d6b8f6 Mon Sep 17 00:00:00 2001 From: Rich Trott Date: Sat, 4 Feb 2017 11:21:37 -0800 Subject: [PATCH] test: throw Error objects instead of literals MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit test-tls-econnreset and test-http-response-status-message throw literals instead of Error objects. Use common.fail() which throws an AssertionError. PR-URL: https://github.com/nodejs/node/pull/11168 Reviewed-By: James M Snell Reviewed-By: Teddy Katz Reviewed-By: Colin Ihrig Reviewed-By: Michaƫl Zasso Reviewed-By: Roman Reiss Reviewed-By: Sakthipriyan Vairamani --- test/parallel/test-http-response-status-message.js | 4 ++-- test/parallel/test-tls-econnreset.js | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/test/parallel/test-http-response-status-message.js b/test/parallel/test-http-response-status-message.js index 95859634ac..14fcb43027 100644 --- a/test/parallel/test-http-response-status-message.js +++ b/test/parallel/test-http-response-status-message.js @@ -1,5 +1,5 @@ 'use strict'; -require('../common'); +const common = require('../common'); const assert = require('assert'); const http = require('http'); const net = require('net'); @@ -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]; }; diff --git a/test/parallel/test-tls-econnreset.js b/test/parallel/test-tls-econnreset.js index c0df9948f4..6bf84a2d0e 100644 --- a/test/parallel/test-tls-econnreset.js +++ b/test/parallel/test-tls-econnreset.js @@ -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;