From 576fe339a1fc3c508795664a49470770668d9e0a Mon Sep 17 00:00:00 2001 From: cjihrig Date: Tue, 30 Apr 2019 10:59:10 -0400 Subject: [PATCH] tls: simplify enableTrace logic PR-URL: https://github.com/nodejs/node/pull/27497 Reviewed-By: Anna Henningsen Reviewed-By: Richard Lau Reviewed-By: Rich Trott --- lib/_tls_wrap.js | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/lib/_tls_wrap.js b/lib/_tls_wrap.js index b999c7332941c5..64add601e74f84 100644 --- a/lib/_tls_wrap.js +++ b/lib/_tls_wrap.js @@ -998,13 +998,12 @@ function Server(options, listener) { } const enableTrace = options.enableTrace; - if (enableTrace === true) - this[kEnableTrace] = true; - else if (enableTrace === false || enableTrace == null) - ; // Tracing explicitly disabled, or defaulting to disabled. - else + if (typeof enableTrace === 'boolean') { + this[kEnableTrace] = enableTrace; + } else if (enableTrace != null) { throw new ERR_INVALID_ARG_TYPE( 'options.enableTrace', 'boolean', enableTrace); + } } Object.setPrototypeOf(Server.prototype, net.Server.prototype);