From 9ad994befbb319e31b2fef3551134ff95be06069 Mon Sep 17 00:00:00 2001 From: James M Snell Date: Fri, 27 Oct 2017 23:24:15 -0700 Subject: dgram: migrate bufferSize to use internal/errors PR-URL: https://github.com/nodejs/node/pull/16567 Reviewed-By: Joyee Cheung Reviewed-By: Michael Dawson --- src/udp_wrap.cc | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) (limited to 'src/udp_wrap.cc') diff --git a/src/udp_wrap.cc b/src/udp_wrap.cc index b3702ea6e3..05682a3e1f 100644 --- a/src/udp_wrap.cc +++ b/src/udp_wrap.cc @@ -234,8 +234,10 @@ void UDPWrap::BufferSize(const FunctionCallbackInfo& args) { const char* uv_func_name = is_recv ? "uv_recv_buffer_size" : "uv_send_buffer_size"; - if (!args[0]->IsInt32()) - return env->ThrowUVException(UV_EINVAL, uv_func_name); + if (!args[0]->IsInt32()) { + env->CollectUVExceptionInfo(args[2], UV_EINVAL, uv_func_name); + return args.GetReturnValue().SetUndefined(); + } uv_handle_t* handle = reinterpret_cast(&wrap->handle_); int size = static_cast(args[0].As()->Value()); @@ -246,8 +248,10 @@ void UDPWrap::BufferSize(const FunctionCallbackInfo& args) { else err = uv_send_buffer_size(handle, &size); - if (err != 0) - return env->ThrowUVException(err, uv_func_name); + if (err != 0) { + env->CollectUVExceptionInfo(args[2], err, uv_func_name); + return args.GetReturnValue().SetUndefined(); + } args.GetReturnValue().Set(size); } -- cgit v1.2.3