summaryrefslogtreecommitdiff
path: root/src/pipe_wrap.cc
diff options
context:
space:
mode:
authorBen Noordhuis <info@bnoordhuis.nl>2013-09-28 10:27:11 +0200
committerBen Noordhuis <info@bnoordhuis.nl>2013-09-28 10:35:57 +0200
commit994ce4c99fb1e284bcfdc2500ae62e0138bf140e (patch)
treeaf2668d6e2f35304b1e6c44165d50ba7a01289e0 /src/pipe_wrap.cc
parent671b5be6e9d74fec9e94b1ab88d2b2648c540078 (diff)
downloadandroid-node-v8-994ce4c99fb1e284bcfdc2500ae62e0138bf140e.tar.gz
android-node-v8-994ce4c99fb1e284bcfdc2500ae62e0138bf140e.tar.bz2
android-node-v8-994ce4c99fb1e284bcfdc2500ae62e0138bf140e.zip
src: turn uv_pipe_open() failures into exceptions
uv_pipe_open() is unlikely to fail but when it does, the failure should not be quietly ignored. Raise the error as an exception. See joyent/libuv#941.
Diffstat (limited to 'src/pipe_wrap.cc')
-rw-r--r--src/pipe_wrap.cc7
1 files changed, 4 insertions, 3 deletions
diff --git a/src/pipe_wrap.cc b/src/pipe_wrap.cc
index 3952a0799c..14104b1a5d 100644
--- a/src/pipe_wrap.cc
+++ b/src/pipe_wrap.cc
@@ -269,9 +269,10 @@ Handle<Value> PipeWrap::Open(const Arguments& args) {
UNWRAP(PipeWrap)
- int fd = args[0]->IntegerValue();
-
- uv_pipe_open(&wrap->handle_, fd);
+ if (uv_pipe_open(&wrap->handle_, args[0]->Int32Value())) {
+ uv_err_t err = uv_last_error(wrap->handle_.loop);
+ return ThrowException(UVException(err.code, "uv_pipe_open"));
+ }
return scope.Close(v8::Null());
}