From b741f2ff84fb2044d3100a50ecda74779e2c0608 Mon Sep 17 00:00:00 2001 From: James M Snell Date: Fri, 2 Oct 2020 14:49:40 -0700 Subject: [PATCH] src: move node_process to modern THROW_ERR* Signed-off-by: James M Snell PR-URL: https://github.com/nodejs/node/pull/35472 Reviewed-By: Joyee Cheung --- src/node_process_methods.cc | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/src/node_process_methods.cc b/src/node_process_methods.cc index 82be06aa7869ca..b506050e507559 100644 --- a/src/node_process_methods.cc +++ b/src/node_process_methods.cc @@ -157,8 +157,9 @@ static void Kill(const FunctionCallbackInfo& args) { Environment* env = Environment::GetCurrent(args); Local 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; @@ -322,8 +323,8 @@ static void ResourceUsage(const FunctionCallbackInfo& args) { static void DebugProcess(const FunctionCallbackInfo& 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()); @@ -347,9 +348,8 @@ static void DebugProcess(const FunctionCallbackInfo& 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;