Browse Source

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.
v0.10.20-release
Ben Noordhuis 11 years ago
parent
commit
994ce4c99f
  1. 7
      src/pipe_wrap.cc

7
src/pipe_wrap.cc

@ -269,9 +269,10 @@ Handle<Value> PipeWrap::Open(const Arguments& args) {
UNWRAP(PipeWrap) UNWRAP(PipeWrap)
int fd = args[0]->IntegerValue(); if (uv_pipe_open(&wrap->handle_, args[0]->Int32Value())) {
uv_err_t err = uv_last_error(wrap->handle_.loop);
uv_pipe_open(&wrap->handle_, fd); return ThrowException(UVException(err.code, "uv_pipe_open"));
}
return scope.Close(v8::Null()); return scope.Close(v8::Null());
} }

Loading…
Cancel
Save