@@ -5884,11 +5884,7 @@ void DiffieHellman::ComputeSecret(const FunctionCallbackInfo<Value>& args) {
5884
5884
5885
5885
ClearErrorOnReturn clear_error_on_return;
5886
5886
5887
- if (args.Length () == 0 ) {
5888
- return THROW_ERR_MISSING_ARGS (
5889
- env, " Other party's public key argument is mandatory" );
5890
- }
5891
-
5887
+ CHECK_EQ (args.Length (), 1 );
5892
5888
THROW_AND_RETURN_IF_NOT_BUFFER (env, args[0 ], " Other party's public key" );
5893
5889
ArrayBufferViewContents<unsigned char > key_buf (args[0 ].As <ArrayBufferView>());
5894
5890
BignumPointer key (BN_bin2bn (key_buf.data (), key_buf.length (), nullptr ));
@@ -5948,11 +5944,7 @@ void DiffieHellman::SetKey(const FunctionCallbackInfo<Value>& args,
5948
5944
5949
5945
char errmsg[64 ];
5950
5946
5951
- if (args.Length () == 0 ) {
5952
- snprintf (errmsg, sizeof (errmsg), " %s argument is mandatory" , what);
5953
- return THROW_ERR_MISSING_ARGS (env, errmsg);
5954
- }
5955
-
5947
+ CHECK_EQ (args.Length (), 1 );
5956
5948
if (!Buffer::HasInstance (args[0 ])) {
5957
5949
snprintf (errmsg, sizeof (errmsg), " %s must be a buffer" , what);
5958
5950
return THROW_ERR_INVALID_ARG_TYPE (env, errmsg);
0 commit comments