summaryrefslogtreecommitdiff
path: root/src/udp_wrap.cc
diff options
context:
space:
mode:
authorJames M Snell <jasnell@gmail.com>2017-10-27 23:24:15 -0700
committerJames M Snell <jasnell@gmail.com>2017-11-02 11:58:38 -0700
commit9ad994befbb319e31b2fef3551134ff95be06069 (patch)
treed3712b62dbe750a52de6db7bd0d74c74c36cb68a /src/udp_wrap.cc
parent3d9d84940ae11a026c8f14e1b502794db7538765 (diff)
downloadandroid-node-v8-9ad994befbb319e31b2fef3551134ff95be06069.tar.gz
android-node-v8-9ad994befbb319e31b2fef3551134ff95be06069.tar.bz2
android-node-v8-9ad994befbb319e31b2fef3551134ff95be06069.zip
dgram: migrate bufferSize to use internal/errors
PR-URL: https://github.com/nodejs/node/pull/16567 Reviewed-By: Joyee Cheung <joyeec9h3@gmail.com> Reviewed-By: Michael Dawson <michael_dawson@ca.ibm.com>
Diffstat (limited to 'src/udp_wrap.cc')
-rw-r--r--src/udp_wrap.cc12
1 files changed, 8 insertions, 4 deletions
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<Value>& 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<uv_handle_t*>(&wrap->handle_);
int size = static_cast<int>(args[0].As<Uint32>()->Value());
@@ -246,8 +248,10 @@ void UDPWrap::BufferSize(const FunctionCallbackInfo<Value>& 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);
}