tls: include invalid method name in thrown error
When an invalid TLS method name error is thrown, include the invalid name in the error message. PR-URL: https://github.com/nodejs/node/pull/27390 Reviewed-By: Richard Lau <riclau@uk.ibm.com> Reviewed-By: Colin Ihrig <cjihrig@gmail.com> Reviewed-By: Brian White <mscdex@mscdex.net> Reviewed-By: James M Snell <jasnell@gmail.com>
This commit is contained in:
parent
1d022e8253
commit
86b4f3729a
@ -627,7 +627,8 @@ void SecureContext::Init(const FunctionCallbackInfo<Value>& args) {
|
||||
max_version = TLS1_2_VERSION;
|
||||
method = TLS_client_method();
|
||||
} else {
|
||||
THROW_ERR_TLS_INVALID_PROTOCOL_METHOD(env, "Unknown method");
|
||||
const std::string msg("Unknown method: ");
|
||||
THROW_ERR_TLS_INVALID_PROTOCOL_METHOD(env, (msg + * sslmethod).c_str());
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
@ -8,7 +8,10 @@ const tls = require('tls');
|
||||
|
||||
assert.throws(function() {
|
||||
tls.createSecureContext({ secureProtocol: 'blargh' });
|
||||
}, /Unknown method/);
|
||||
}, {
|
||||
code: 'ERR_TLS_INVALID_PROTOCOL_METHOD',
|
||||
message: 'Unknown method: blargh',
|
||||
});
|
||||
|
||||
const errMessageSSLv2 = /SSLv2 methods disabled/;
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user