From 994ce4c99fb1e284bcfdc2500ae62e0138bf140e Mon Sep 17 00:00:00 2001 From: Ben Noordhuis Date: Sat, 28 Sep 2013 10:27:11 +0200 Subject: [PATCH] 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. --- src/pipe_wrap.cc | 7 ++++--- 1 file 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 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()); }