From c986b99ddc63945a845627a485ef8184c3372888 Mon Sep 17 00:00:00 2001 From: Ryan Date: Wed, 22 Apr 2009 14:01:06 +0200 Subject: [PATCH] throw error when given a bad arguement to socket.write --- src/net.cc | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/net.cc b/src/net.cc index 16885ef..81bba00 100644 --- a/src/net.cc +++ b/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(); } -- 2.7.4