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.
This commit is contained in:
Ben Noordhuis committed 2013-09-28 10:35:57 +02:00
1 parent 671b5be6e9
commit 994ce4c99f
1 file changed
+4 -3
+4 -3
View File
@@ -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());
}