Skip to content

Commit 057da6e

Browse files
committed
lib,src: update exit codes as per todos
Refs: nodejs#44746
1 parent b4a962d commit 057da6e

File tree

3 files changed

+7
-6
lines changed

3 files changed

+7
-6
lines changed

lib/internal/debugger/inspect.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,7 @@ const {
4545
exitCodes: {
4646
kGenericUserError,
4747
kNoFailure,
48+
kInvalidCommandLineArgument,
4849
},
4950
} = internalBinding('errors');
5051

@@ -340,7 +341,7 @@ function startInspect(argv = ArrayPrototypeSlice(process.argv, 2),
340341
` ${invokedAs} --port=<port>\n` +
341342
` ${invokedAs} -p <pid>\n`);
342343
// TODO(joyeecheung): should be kInvalidCommandLineArgument.
343-
process.exit(kGenericUserError);
344+
process.exit(kInvalidCommandLineArgument);
344345
}
345346

346347
const options = parseArgv(argv);

lib/internal/main/repl.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ const console = require('internal/console/global');
1616

1717
const { getOptionValue } = require('internal/options');
1818

19-
const { exitCodes: { kGenericUserError } } = internalBinding('errors');
19+
const { exitCodes: { kInvalidCommandLineArgument } } = internalBinding('errors');
2020

2121
prepareMainThreadExecution();
2222

@@ -33,7 +33,7 @@ if (process.env.NODE_REPL_EXTERNAL_MODULE) {
3333
// so use console.error.
3434
console.error('Cannot specify --input-type for REPL');
3535
// TODO(joyeecheung): should be kInvalidCommandLineArgument.
36-
process.exit(kGenericUserError);
36+
process.exit(kInvalidCommandLineArgument);
3737
}
3838

3939
const esmLoader = require('internal/process/esm_loader');

src/node.cc

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1133,7 +1133,7 @@ ExitCode GenerateAndWriteSnapshotData(const SnapshotData** snapshot_data_ptr,
11331133
"entry point but Node.js was built without embedded "
11341134
"snapshot.\n");
11351135
// TODO(joyeecheung): should be kInvalidCommandLineArgument instead.
1136-
exit_code = ExitCode::kGenericUserError;
1136+
exit_code = ExitCode::kInvalidCommandLineArgument;
11371137
return exit_code;
11381138
}
11391139
} else {
@@ -1167,7 +1167,7 @@ ExitCode GenerateAndWriteSnapshotData(const SnapshotData** snapshot_data_ptr,
11671167
"Cannot open %s for writing a snapshot.\n",
11681168
snapshot_blob_path.c_str());
11691169
// TODO(joyeecheung): should be kStartupSnapshotFailure.
1170-
exit_code = ExitCode::kGenericUserError;
1170+
exit_code = ExitCode::kStartupSnapshotFailure;
11711171
}
11721172
return exit_code;
11731173
}
@@ -1193,7 +1193,7 @@ ExitCode LoadSnapshotDataAndRun(const SnapshotData** snapshot_data_ptr,
11931193
if (!ok) {
11941194
// If we fail to read the customized snapshot, simply exit with 1.
11951195
// TODO(joyeecheung): should be kStartupSnapshotFailure.
1196-
exit_code = ExitCode::kGenericUserError;
1196+
exit_code = ExitCode::kStartupSnapshotFailure;
11971197
return exit_code;
11981198
}
11991199
*snapshot_data_ptr = read_data.release();

0 commit comments

Comments
 (0)