Skip to content

Commit b741f2f

Browse files
jasnellMylesBorins
authored andcommittedNov 16, 2020
src: move node_process to modern THROW_ERR*
Signed-off-by: James M Snell <jasnell@gmail.com> PR-URL: #35472 Reviewed-By: Joyee Cheung <joyeec9h3@gmail.com>
1 parent 992355c commit b741f2f

File tree

1 file changed

+7
-7
lines changed

1 file changed

+7
-7
lines changed
 

‎src/node_process_methods.cc

+7-7
Original file line numberDiff line numberDiff line change
@@ -157,8 +157,9 @@ static void Kill(const FunctionCallbackInfo<Value>& args) {
157157
Environment* env = Environment::GetCurrent(args);
158158
Local<Context> context = env->context();
159159

160-
if (args.Length() != 2)
161-
return env->ThrowError("Bad argument.");
160+
if (args.Length() < 2) {
161+
THROW_ERR_MISSING_ARGS(env, "Bad argument.");
162+
}
162163

163164
int pid;
164165
if (!args[0]->Int32Value(context).To(&pid)) return;
@@ -322,8 +323,8 @@ static void ResourceUsage(const FunctionCallbackInfo<Value>& args) {
322323
static void DebugProcess(const FunctionCallbackInfo<Value>& args) {
323324
Environment* env = Environment::GetCurrent(args);
324325

325-
if (args.Length() != 1) {
326-
return env->ThrowError("Invalid number of arguments.");
326+
if (args.Length() < 1) {
327+
return THROW_ERR_MISSING_ARGS(env, "Invalid number of arguments.");
327328
}
328329

329330
CHECK(args[0]->IsNumber());
@@ -347,9 +348,8 @@ static void DebugProcess(const FunctionCallbackInfo<Value>& args) {
347348
Environment* env = Environment::GetCurrent(args);
348349
Isolate* isolate = args.GetIsolate();
349350

350-
if (args.Length() != 1) {
351-
env->ThrowError("Invalid number of arguments.");
352-
return;
351+
if (args.Length() < 1) {
352+
return THROW_ERR_MISSING_ARGS(env, "Invalid number of arguments.");
353353
}
354354

355355
HANDLE process = nullptr;

0 commit comments

Comments
 (0)
Please sign in to comment.