Skip to content

Commit 541082c

Browse files
jasnellMylesBorins
authored andcommitted
src: move node_process to modern THROW_ERR*
Signed-off-by: James M Snell <[email protected]> PR-URL: #35472 Reviewed-By: Joyee Cheung <[email protected]>
1 parent 4164477 commit 541082c

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
@@ -164,8 +164,9 @@ static void Kill(const FunctionCallbackInfo<Value>& args) {
164164
Environment* env = Environment::GetCurrent(args);
165165
Local<Context> context = env->context();
166166

167-
if (args.Length() != 2)
168-
return env->ThrowError("Bad argument.");
167+
if (args.Length() < 2) {
168+
THROW_ERR_MISSING_ARGS(env, "Bad argument.");
169+
}
169170

170171
int pid;
171172
if (!args[0]->Int32Value(context).To(&pid)) return;
@@ -319,8 +320,8 @@ static void ResourceUsage(const FunctionCallbackInfo<Value>& args) {
319320
static void DebugProcess(const FunctionCallbackInfo<Value>& args) {
320321
Environment* env = Environment::GetCurrent(args);
321322

322-
if (args.Length() != 1) {
323-
return env->ThrowError("Invalid number of arguments.");
323+
if (args.Length() < 1) {
324+
return THROW_ERR_MISSING_ARGS(env, "Invalid number of arguments.");
324325
}
325326

326327
CHECK(args[0]->IsNumber());
@@ -344,9 +345,8 @@ static void DebugProcess(const FunctionCallbackInfo<Value>& args) {
344345
Environment* env = Environment::GetCurrent(args);
345346
Isolate* isolate = args.GetIsolate();
346347

347-
if (args.Length() != 1) {
348-
env->ThrowError("Invalid number of arguments.");
349-
return;
348+
if (args.Length() < 1) {
349+
return THROW_ERR_MISSING_ARGS(env, "Invalid number of arguments.");
350350
}
351351

352352
HANDLE process = nullptr;

0 commit comments

Comments
 (0)