Skip to content

Commit

Permalink
.
Browse files Browse the repository at this point in the history
  • Loading branch information
mmastrac committed Apr 8, 2024
1 parent 2e981b2 commit 19fe662
Showing 1 changed file with 8 additions and 4 deletions.
12 changes: 8 additions & 4 deletions ext/net/02_tls.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ import {
const {
Number,
ObjectDefineProperty,
ReflectHas,
TypeError,
} = primordials;

Expand Down Expand Up @@ -137,8 +138,9 @@ class TlsListener extends Listener {
}

function hasTlsKeyPairOptions(options) {
return ("cert" in options || "key" in options || "certFile" in options ||
"keyFile" in options);
return (ReflectHas(options, "cert") || ReflectHas(options, "key") ||
ReflectHas(options, "certFile") ||
ReflectHas(options, "keyFile"));
}

function loadTlsKeyPair(
Expand All @@ -148,10 +150,12 @@ function loadTlsKeyPair(
keyFile,
) {
if ((certFile !== undefined) ^ (keyFile !== undefined)) {
throw new Error("If certFile is specified, keyFile must also be specified");
throw new TypeError(
"If certFile is specified, keyFile must also be specified",
);
}
if ((cert !== undefined) ^ (key !== undefined)) {
throw new Error("If cert is specified, key must also be specified");
throw new TypeError("If cert is specified, key must also be specified");
}

if (certFile !== undefined) {
Expand Down

0 comments on commit 19fe662

Please sign in to comment.