0
0
mirror of https://github.com/nodejs/node.git synced 2024-11-29 07:00:59 +01:00

throw error when given a bad arguement to socket.write

This commit is contained in:
Ryan 2009-04-22 14:01:06 +02:00
parent 3095861199
commit c986b99ddc

View File

@ -423,6 +423,8 @@ Socket::Write (const Arguments& args)
HandleScope scope;
Socket *socket = Socket::Unwrap(args.Holder());
// TODO support a callback using buf->on_release
if (args[0] == Null()) {
oi_socket_write_eof(&socket->socket_);
@ -446,10 +448,8 @@ Socket::Write (const Arguments& args)
}
oi_socket_write(&socket->socket_, buf);
} else {
// raise error bad argument.
assert(0);
}
} else return ThrowException(String::New("Bad argument"));
return Undefined();
}