Skip to content

Commit bf6a457

Browse files
committed
Use assert() for Unwrap checks instead of JS error.
1 parent 041af82 commit bf6a457

File tree

1 file changed

+8
-8
lines changed

1 file changed

+8
-8
lines changed

src/net.cc

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -78,7 +78,7 @@ Handle<Value>
7878
Connection::ReadyStateGetter (Local<String> property, const AccessorInfo& info)
7979
{
8080
Connection *connection = ObjectWrap::Unwrap<Connection>(info.This());
81-
if (!connection) return Handle<Value>();
81+
assert(connection);
8282

8383
HandleScope scope;
8484

@@ -309,7 +309,7 @@ Connection::SetEncoding (const Arguments& args)
309309
HandleScope scope;
310310

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

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

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

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

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

377377
if ( connection->ReadyState() != OPEN
378378
&& connection->ReadyState() != WRITE_ONLY
@@ -576,7 +576,7 @@ Handle<Value>
576576
Server::Listen (const Arguments& args)
577577
{
578578
Server *server = ObjectWrap::Unwrap<Server>(args.Holder());
579-
if (!server) return Handle<Value>();
579+
assert(server);
580580

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

618618
server->Close();
619619
return Undefined();

0 commit comments

Comments
 (0)