From 3ccfeb483df5a6402da9b40346a7eb33cfb4b70a Mon Sep 17 00:00:00 2001 From: Michael Dawson Date: Thu, 29 Jun 2017 19:20:11 -0400 Subject: tls: migrate tls.js to use internal/errors.js Migrate tls.js to use internal/errors.js as per https://github.com/nodejs/node/issues/11273 PR-URL: https://github.com/nodejs/node/pull/13994 Reviewed-By: James M Snell Reviewed-By: Refael Ackermann Reviewed-By: Joyee Cheung Reviewed-By: Matteo Collina --- lib/tls.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'lib/tls.js') diff --git a/lib/tls.js b/lib/tls.js index d89f241383d..30525a254c5 100644 --- a/lib/tls.js +++ b/lib/tls.js @@ -21,6 +21,7 @@ 'use strict'; +const errors = require('internal/errors'); const internalUtil = require('internal/util'); internalUtil.assertCrypto(); @@ -219,8 +220,7 @@ exports.checkServerIdentity = function checkServerIdentity(host, cert) { } if (!valid) { - const err = new Error( - `Hostname/IP doesn't match certificate's altnames: "${reason}"`); + const err = new errors.Error('ERR_TLS_CERT_ALTNAME_INVALID', reason); err.reason = reason; err.host = host; err.cert = cert; -- cgit v1.2.3