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 2013-09-28 10:27:11 +02:00
parent 671b5be6e9
commit 994ce4c99f

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());
}