use ERR_TLS_INVALID_PROTOCOL_VERSION new signature

This commit is contained in:
Alistair Smith
2025-05-08 16:53:39 -07:00
parent 187dc46b71
commit 94293cdf51
2 changed files with 5 additions and 12 deletions

View File

@@ -681,10 +681,7 @@ declare function $ERR_MISSING_ARGS(...args: [string, ...string[]]): TypeError;
*/
declare function $ERR_MISSING_ARGS(oneOf: string[]): TypeError;
declare function $ERR_INVALID_RETURN_VALUE(expected_type: string, name: string, actual_value: any): TypeError;
declare function $ERR_TLS_INVALID_PROTOCOL_VERSION(
a: import("tls").SecureVersion | (string & {}),
b: "maximum" | "minimum",
): TypeError;
declare function $ERR_TLS_INVALID_PROTOCOL_VERSION(a: import("tls").SecureVersion, b: "maximum" | "minimum"): TypeError;
declare function $ERR_TLS_PROTOCOL_VERSION_CONFLICT(a: string, b: string): TypeError;
declare function $ERR_INVALID_IP_ADDRESS(ip: any): TypeError;
declare function $ERR_INVALID_ADDRESS_FAMILY(addressType, host, port): RangeError;

View File

@@ -322,8 +322,8 @@ var InternalSecureContext = class SecureContext {
);
}
let minVersionName;
let maxVersionName;
let minVersionName: SecureVersion | undefined;
let maxVersionName: SecureVersion | undefined;
if (hasSecureProtocol) {
if (typeof secureProtocol !== "string") {
@@ -361,9 +361,7 @@ var InternalSecureContext = class SecureContext {
throw $ERR_INVALID_ARG_TYPE("options.minVersion", "string", minVersionName);
}
if (!(minVersionName in TLS_VERSION_MAP)) {
const err = new TypeError(`The value "${minVersionName}" is invalid for option "minVersion"`);
err.code = "ERR_TLS_INVALID_PROTOCOL_VERSION";
throw err;
throw $ERR_TLS_INVALID_PROTOCOL_VERSION(minVersionName, "minimum");
}
}
this.minVersion = TLS_VERSION_MAP[minVersionName];
@@ -373,9 +371,7 @@ var InternalSecureContext = class SecureContext {
throw $ERR_INVALID_ARG_TYPE("options.maxVersion", "string", maxVersionName);
}
if (!(maxVersionName in TLS_VERSION_MAP)) {
const err = new TypeError(`The value "${maxVersionName}" is invalid for option "maxVersion"`);
err.code = "ERR_TLS_INVALID_PROTOCOL_VERSION";
throw err;
throw $ERR_TLS_INVALID_PROTOCOL_VERSION(maxVersionName, "maximum");
}
}
this.maxVersion = TLS_VERSION_MAP[maxVersionName];