diff options
author | James M Snell <jasnell@gmail.com> | 2020-10-03 00:49:40 +0300 |
---|---|---|
committer | James M Snell <jasnell@gmail.com> | 2020-10-10 18:00:32 +0300 |
commit | b28ba4b177d9b391ee3b2dfe36efd3efc5c8c5f1 (patch) | |
tree | e2f2e92abd9ae8341677cf57d20f5dcd0cdfd290 /src/node_process_methods.cc | |
parent | ff4928f85fb2125be7e8a7f787369ea85c6b5fe6 (diff) |
src: move node_process to modern THROW_ERR*
Signed-off-by: James M Snell <jasnell@gmail.com>
PR-URL: https://github.com/nodejs/node/pull/35472
Reviewed-By: Joyee Cheung <joyeec9h3@gmail.com>
Diffstat (limited to 'src/node_process_methods.cc')
-rw-r--r-- | src/node_process_methods.cc | 14 |
1 files changed, 7 insertions, 7 deletions
diff --git a/src/node_process_methods.cc b/src/node_process_methods.cc index 1d8bcd54057..d14a7642b42 100644 --- a/src/node_process_methods.cc +++ b/src/node_process_methods.cc @@ -137,8 +137,9 @@ static void Kill(const FunctionCallbackInfo<Value>& args) { Environment* env = Environment::GetCurrent(args); Local<Context> context = env->context(); - if (args.Length() != 2) - return env->ThrowError("Bad argument."); + if (args.Length() < 2) { + THROW_ERR_MISSING_ARGS(env, "Bad argument."); + } int pid; if (!args[0]->Int32Value(context).To(&pid)) return; @@ -292,8 +293,8 @@ static void ResourceUsage(const FunctionCallbackInfo<Value>& args) { static void DebugProcess(const FunctionCallbackInfo<Value>& args) { Environment* env = Environment::GetCurrent(args); - if (args.Length() != 1) { - return env->ThrowError("Invalid number of arguments."); + if (args.Length() < 1) { + return THROW_ERR_MISSING_ARGS(env, "Invalid number of arguments."); } CHECK(args[0]->IsNumber()); @@ -317,9 +318,8 @@ static void DebugProcess(const FunctionCallbackInfo<Value>& args) { Environment* env = Environment::GetCurrent(args); Isolate* isolate = args.GetIsolate(); - if (args.Length() != 1) { - env->ThrowError("Invalid number of arguments."); - return; + if (args.Length() < 1) { + return THROW_ERR_MISSING_ARGS(env, "Invalid number of arguments."); } HANDLE process = nullptr; |