diff options
author | Ben Noordhuis <info@bnoordhuis.nl> | 2013-09-28 12:27:11 +0400 |
---|---|---|
committer | Ben Noordhuis <info@bnoordhuis.nl> | 2013-09-28 12:35:57 +0400 |
commit | 994ce4c99fb1e284bcfdc2500ae62e0138bf140e (patch) | |
tree | af2668d6e2f35304b1e6c44165d50ba7a01289e0 /src/pipe_wrap.cc | |
parent | 671b5be6e9d74fec9e94b1ab88d2b2648c540078 (diff) |
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.cc | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/src/pipe_wrap.cc b/src/pipe_wrap.cc index 3952a0799c4..14104b1a5d9 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()); } |