diff options
author | James M Snell <jasnell@gmail.com> | 2017-10-27 16:27:16 -0700 |
---|---|---|
committer | James M Snell <jasnell@gmail.com> | 2017-11-02 11:58:38 -0700 |
commit | 056b858e57a72c5429d9278bc7b77d1922a2dbe4 (patch) | |
tree | 71a7ad2be887c50d4bf5c2d461fe7a16131e3181 /src/node_os.cc | |
parent | c3dc0e0d75cc5a03de154f3586e1062df1e719e4 (diff) | |
download | android-node-v8-056b858e57a72c5429d9278bc7b77d1922a2dbe4.tar.gz android-node-v8-056b858e57a72c5429d9278bc7b77d1922a2dbe4.tar.bz2 android-node-v8-056b858e57a72c5429d9278bc7b77d1922a2dbe4.zip |
os: migrate node_os.cc to 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/node_os.cc')
-rw-r--r-- | src/node_os.cc | 26 |
1 files changed, 20 insertions, 6 deletions
diff --git a/src/node_os.cc b/src/node_os.cc index f09cd6fa5a..c57841ca9e 100644 --- a/src/node_os.cc +++ b/src/node_os.cc @@ -72,7 +72,9 @@ static void GetHostname(const FunctionCallbackInfo<Value>& args) { #else // __MINGW32__ int errorno = WSAGetLastError(); #endif // __POSIX__ - return env->ThrowErrnoException(errorno, "gethostname"); + CHECK_GE(args.Length(), 1); + env->CollectExceptionInfo(args[args.Length() - 1], errorno, "gethostname"); + return args.GetReturnValue().SetUndefined(); } buf[sizeof(buf) - 1] = '\0'; @@ -87,7 +89,9 @@ static void GetOSType(const FunctionCallbackInfo<Value>& args) { #ifdef __POSIX__ struct utsname info; if (uname(&info) < 0) { - return env->ThrowErrnoException(errno, "uname"); + CHECK_GE(args.Length(), 1); + env->CollectExceptionInfo(args[args.Length() - 1], errno, "uname"); + return args.GetReturnValue().SetUndefined(); } rval = info.sysname; #else // __MINGW32__ @@ -105,7 +109,9 @@ static void GetOSRelease(const FunctionCallbackInfo<Value>& args) { #ifdef __POSIX__ struct utsname info; if (uname(&info) < 0) { - return env->ThrowErrnoException(errno, "uname"); + CHECK_GE(args.Length(), 1); + env->CollectExceptionInfo(args[args.Length() - 1], errno, "uname"); + return args.GetReturnValue().SetUndefined(); } # ifdef _AIX char release[256]; @@ -242,7 +248,10 @@ static void GetInterfaceAddresses(const FunctionCallbackInfo<Value>& args) { if (err == UV_ENOSYS) { return args.GetReturnValue().Set(ret); } else if (err) { - return env->ThrowUVException(err, "uv_interface_addresses"); + CHECK_GE(args.Length(), 1); + env->CollectUVExceptionInfo(args[args.Length() - 1], errno, + "uv_interface_addresses"); + return args.GetReturnValue().SetUndefined(); } for (i = 0; i < count; i++) { @@ -319,7 +328,9 @@ static void GetHomeDirectory(const FunctionCallbackInfo<Value>& args) { const int err = uv_os_homedir(buf, &len); if (err) { - return env->ThrowUVException(err, "uv_os_homedir"); + CHECK_GE(args.Length(), 1); + env->CollectUVExceptionInfo(args[args.Length() - 1], err, "uv_os_homedir"); + return args.GetReturnValue().SetUndefined(); } Local<String> home = String::NewFromUtf8(env->isolate(), @@ -351,7 +362,10 @@ static void GetUserInfo(const FunctionCallbackInfo<Value>& args) { const int err = uv_os_get_passwd(&pwd); if (err) { - return env->ThrowUVException(err, "uv_os_get_passwd"); + CHECK_GE(args.Length(), 2); + env->CollectUVExceptionInfo(args[args.Length() - 1], err, + "uv_os_get_passwd"); + return args.GetReturnValue().SetUndefined(); } Local<Value> error; |