Browse Source

throw error when given a bad arguement to socket.write

v0.7.4-release
Ryan 16 years ago
parent
commit
c986b99ddc
  1. 8
      src/net.cc

8
src/net.cc

@ -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();
}

Loading…
Cancel
Save