summaryrefslogtreecommitdiff
path: root/src/node_net2.cc
diff options
context:
space:
mode:
authorRyan Dahl <ry@tinyclouds.org>2010-02-08 07:36:40 -0800
committerRyan Dahl <ry@tinyclouds.org>2010-02-08 07:36:40 -0800
commitb6edae5671e24cc0b057096b4ab8beac083aea7b (patch)
tree6910a48b09ccd826a83140461060191d74631061 /src/node_net2.cc
parent979f5889d5366e93e6fc4355e891f34098055059 (diff)
downloadnodejs-b6edae5671e24cc0b057096b4ab8beac083aea7b.tar.gz
nodejs-b6edae5671e24cc0b057096b4ab8beac083aea7b.tar.bz2
nodejs-b6edae5671e24cc0b057096b4ab8beac083aea7b.zip
Expose errno exception creation
Diffstat (limited to 'src/node_net2.cc')
-rw-r--r--src/node_net2.cc13
1 files changed, 13 insertions, 0 deletions
diff --git a/src/node_net2.cc b/src/node_net2.cc
index 5e7cfef17..560db1db9 100644
--- a/src/node_net2.cc
+++ b/src/node_net2.cc
@@ -1246,6 +1246,18 @@ static Handle<Value> NeedsLookup(const Arguments& args) {
}
+static Handle<Value> CreateErrnoException(const Arguments& args) {
+ HandleScope scope;
+
+ int errorno = args[0]->Int32Value();
+ String::Utf8Value syscall(args[1]->ToString());
+
+ Local<Value> exception = ErrnoException(errorno, *syscall);
+
+ return scope.Close(exception);
+}
+
+
void InitNet2(Handle<Object> target) {
HandleScope scope;
@@ -1275,6 +1287,7 @@ void InitNet2(Handle<Object> target) {
NODE_SET_METHOD(target, "getpeername", GetPeerName);
NODE_SET_METHOD(target, "getaddrinfo", GetAddrInfo);
NODE_SET_METHOD(target, "needsLookup", NeedsLookup);
+ NODE_SET_METHOD(target, "errnoException", CreateErrnoException);
target->Set(String::NewSymbol("ENOENT"), Integer::New(ENOENT));
target->Set(String::NewSymbol("EINPROGRESS"), Integer::New(EINPROGRESS));