Skip to content

Commit

Permalink
src: turn uv_pipe_open() failures into exceptions
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
bnoordhuis committed Sep 28, 2013
1 parent 671b5be commit 994ce4c
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions src/pipe_wrap.cc
Original file line number Diff line number Diff line change
Expand Up @@ -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());
}
Expand Down

0 comments on commit 994ce4c

Please sign in to comment.