Browse Source

Add Exception::Error where missing.

v0.7.4-release
Ryan 16 years ago
parent
commit
393caeb4c9
  1. 6
      src/child_process.cc
  2. 8
      src/dns.cc
  3. 2
      src/net.cc
  4. 4
      src/node_stdio.cc

6
src/child_process.cc

@ -48,7 +48,7 @@ Handle<Value>
ChildProcess::Spawn (const Arguments& args) ChildProcess::Spawn (const Arguments& args)
{ {
if (args.Length() == 0 || !args[0]->IsString()) { if (args.Length() == 0 || !args[0]->IsString()) {
return ThrowException(String::New("Bad argument.")); return ThrowException(Exception::Error(String::New("Bad argument.")));
} }
HandleScope scope; HandleScope scope;
@ -58,7 +58,7 @@ ChildProcess::Spawn (const Arguments& args)
int r = child->Spawn(*command); int r = child->Spawn(*command);
if (r != 0) { if (r != 0) {
return ThrowException(String::New("Error spawning")); return ThrowException(Exception::Error(String::New("Error spawning")));
} }
child->handle_->Set(PID_SYMBOL, Integer::New(child->pid_)); child->handle_->Set(PID_SYMBOL, Integer::New(child->pid_));
@ -100,7 +100,7 @@ ChildProcess::Kill (const Arguments& args)
if (args[0]->IsInt32()) sig = args[0]->Int32Value(); if (args[0]->IsInt32()) sig = args[0]->Int32Value();
if (child->Kill(sig) != 0) { if (child->Kill(sig) != 0) {
return ThrowException(String::New("ChildProcess already dead")); return ThrowException(Exception::Error(String::New("ChildProcess already dead")));
} }
return Undefined(); return Undefined();

8
src/dns.cc

@ -151,7 +151,7 @@ ResolveA (int type, const Arguments& args)
HandleScope scope; HandleScope scope;
if (args.Length() == 0 || !args[0]->IsString()) { if (args.Length() == 0 || !args[0]->IsString()) {
return ThrowException(String::New("Argument must be a string.")); return ThrowException(Exception::Error(String::New("Argument must be a string.")));
} }
String::Utf8Value name(args[0]->ToString()); String::Utf8Value name(args[0]->ToString());
@ -168,7 +168,7 @@ ResolveA (int type, const Arguments& args)
break; break;
default: default:
return ThrowException(String::New("Unsupported type")); return ThrowException(Exception::Error(String::New("Unsupported type")));
} }
assert(query); // TODO better error handling. assert(query); // TODO better error handling.
@ -230,7 +230,7 @@ Reverse (const Arguments& args)
HandleScope scope; HandleScope scope;
if (args.Length() == 0 || !args[0]->IsString()) { if (args.Length() == 0 || !args[0]->IsString()) {
return ThrowException(String::New("Argument must be a string.")); return ThrowException(Exception::Error(String::New("Argument must be a string.")));
} }
String::Utf8Value ip_address(args[0]->ToString()); String::Utf8Value ip_address(args[0]->ToString());
@ -247,7 +247,7 @@ Reverse (const Arguments& args)
} else if (dns_pton(AF_INET6, *ip_address, &a.addr6) > 0) { } else if (dns_pton(AF_INET6, *ip_address, &a.addr6) > 0) {
v4 = false; v4 = false;
} else { } else {
return ThrowException(String::New("Invalid IP address")); return ThrowException(Exception::Error(String::New("Invalid IP address")));
} }

2
src/net.cc

@ -99,7 +99,7 @@ Connection::ReadyStateGetter (Local<String> property, const AccessorInfo& info)
} }
assert(0 && "This shouldnt happen"); assert(0 && "This shouldnt happen");
return ThrowException(String::New("This shouldn't happen.")); return ThrowException(Exception::Error(String::New("This shouldn't happen.")));
} }
void void

4
src/node_stdio.cc

@ -155,7 +155,7 @@ Open (const Arguments& args)
HandleScope scope; HandleScope scope;
if (stdin_fd >= 0) { if (stdin_fd >= 0) {
return ThrowException(String::New("stdin already open")); return ThrowException(Exception::Error(String::New("stdin already open")));
} }
stdin_encoding = UTF8; stdin_encoding = UTF8;
@ -190,7 +190,7 @@ Close (const Arguments& args)
HandleScope scope; HandleScope scope;
if (stdin_fd < 0) { if (stdin_fd < 0) {
return ThrowException(String::New("stdin not open")); return ThrowException(Exception::Error(String::New("stdin not open")));
} }
evcom_reader_close(&in); evcom_reader_close(&in);

Loading…
Cancel
Save