We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent b0c65bb commit 34769a1Copy full SHA for 34769a1
src/tcp_wrap.cc
@@ -291,6 +291,13 @@ void TCPWrap::Listen(const FunctionCallbackInfo<Value>& args) {
291
292
293
void TCPWrap::Connect(const FunctionCallbackInfo<Value>& args) {
294
+ if (args.Length() <= 2) {
295
+ // Throw an exception for insufficient arguments
296
+ args.GetIsolate()->ThrowException(v8::Exception::TypeError(
297
+ v8::String::NewFromUtf8(args.GetIsolate(), "Insufficient arguments").ToLocalChecked()));
298
+ return;
299
+ }
300
+
301
CHECK(args[2]->IsUint32());
302
// explicit cast to fit to libuv's type expectation
303
int port = static_cast<int>(args[2].As<Uint32>()->Value());
0 commit comments