Skip to content
This repository has been archived by the owner on Apr 22, 2023. It is now read-only.

Commit

Permalink
Use assert() for Unwrap checks instead of JS error.
Browse files Browse the repository at this point in the history
  • Loading branch information
ry committed Jul 13, 2009
1 parent 041af82 commit bf6a457
Showing 1 changed file with 8 additions and 8 deletions.
16 changes: 8 additions & 8 deletions src/net.cc
Expand Up @@ -78,7 +78,7 @@ Handle<Value>
Connection::ReadyStateGetter (Local<String> property, const AccessorInfo& info)
{
Connection *connection = ObjectWrap::Unwrap<Connection>(info.This());
if (!connection) return Handle<Value>();
assert(connection);

HandleScope scope;

Expand Down Expand Up @@ -309,7 +309,7 @@ Connection::SetEncoding (const Arguments& args)
HandleScope scope;

Connection *connection = ObjectWrap::Unwrap<Connection>(args.This());
if (!connection) return Handle<Value>();
assert(connection);

if (!args[0]->IsString()) {
connection->encoding_ = RAW;
Expand Down Expand Up @@ -337,7 +337,7 @@ Connection::Close (const Arguments& args)
{
HandleScope scope;
Connection *connection = ObjectWrap::Unwrap<Connection>(args.Holder());
if (!connection) return Handle<Value>();
assert(connection);

connection->Close();
return Undefined();
Expand All @@ -348,7 +348,7 @@ Connection::FullClose (const Arguments& args)
{
HandleScope scope;
Connection *connection = ObjectWrap::Unwrap<Connection>(args.Holder());
if (!connection) return Handle<Value>();
assert(connection);

connection->FullClose();
return Undefined();
Expand All @@ -359,7 +359,7 @@ Connection::ForceClose (const Arguments& args)
{
HandleScope scope;
Connection *connection = ObjectWrap::Unwrap<Connection>(args.Holder());
if (!connection) return Handle<Value>();
assert(connection);

connection->ForceClose();
connection->Detach();
Expand All @@ -372,7 +372,7 @@ Connection::Send (const Arguments& args)
{
HandleScope scope;
Connection *connection = ObjectWrap::Unwrap<Connection>(args.Holder());
if (!connection) return Handle<Value>();
assert(connection);

if ( connection->ReadyState() != OPEN
&& connection->ReadyState() != WRITE_ONLY
Expand Down Expand Up @@ -576,7 +576,7 @@ Handle<Value>
Server::Listen (const Arguments& args)
{
Server *server = ObjectWrap::Unwrap<Server>(args.Holder());
if (!server) return Handle<Value>();
assert(server);

if (args.Length() == 0)
return ThrowException(String::New("Must give at least a port as argument."));
Expand Down Expand Up @@ -613,7 +613,7 @@ Handle<Value>
Server::Close (const Arguments& args)
{
Server *server = ObjectWrap::Unwrap<Server>(args.Holder());
if (!server) return Handle<Value>();
assert(server);

server->Close();
return Undefined();
Expand Down

0 comments on commit bf6a457

Please sign in to comment.