Skip to content

Commit

Permalink
src: move node_process to modern THROW_ERR*
Browse files Browse the repository at this point in the history
Signed-off-by: James M Snell <jasnell@gmail.com>

PR-URL: #35472
Reviewed-By: Joyee Cheung <joyeec9h3@gmail.com>
  • Loading branch information
jasnell authored and MylesBorins committed Nov 16, 2020
1 parent 992355c commit b741f2f
Showing 1 changed file with 7 additions and 7 deletions.
14 changes: 7 additions & 7 deletions src/node_process_methods.cc
Original file line number Diff line number Diff line change
Expand Up @@ -157,8 +157,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;
Expand Down Expand Up @@ -322,8 +323,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());
Expand All @@ -347,9 +348,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;
Expand Down

0 comments on commit b741f2f

Please sign in to comment.