Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

src: move node_process to modern THROW_ERR* #35472

Closed
wants to merge 1 commit into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
14 changes: 7 additions & 7 deletions src/node_process_methods.cc
Expand Up @@ -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;
Expand Down Expand Up @@ -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());
Expand All @@ -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;
Expand Down