Skip to content

Commit

Permalink
lib,src: update exit codes as per todos
Browse files Browse the repository at this point in the history
  • Loading branch information
debadree25 committed Feb 19, 2023
1 parent b4a962d commit 057da6e
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 6 deletions.
3 changes: 2 additions & 1 deletion lib/internal/debugger/inspect.js
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@ const {
exitCodes: {
kGenericUserError,
kNoFailure,
kInvalidCommandLineArgument,
},
} = internalBinding('errors');

Expand Down Expand Up @@ -340,7 +341,7 @@ function startInspect(argv = ArrayPrototypeSlice(process.argv, 2),
` ${invokedAs} --port=<port>\n` +
` ${invokedAs} -p <pid>\n`);
// TODO(joyeecheung): should be kInvalidCommandLineArgument.
process.exit(kGenericUserError);
process.exit(kInvalidCommandLineArgument);
}

const options = parseArgv(argv);
Expand Down
4 changes: 2 additions & 2 deletions lib/internal/main/repl.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ const console = require('internal/console/global');

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

const { exitCodes: { kGenericUserError } } = internalBinding('errors');
const { exitCodes: { kInvalidCommandLineArgument } } = internalBinding('errors');

prepareMainThreadExecution();

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

const esmLoader = require('internal/process/esm_loader');
Expand Down
6 changes: 3 additions & 3 deletions src/node.cc
Original file line number Diff line number Diff line change
Expand Up @@ -1133,7 +1133,7 @@ ExitCode GenerateAndWriteSnapshotData(const SnapshotData** snapshot_data_ptr,
"entry point but Node.js was built without embedded "
"snapshot.\n");
// TODO(joyeecheung): should be kInvalidCommandLineArgument instead.
exit_code = ExitCode::kGenericUserError;
exit_code = ExitCode::kInvalidCommandLineArgument;
return exit_code;
}
} else {
Expand Down Expand Up @@ -1167,7 +1167,7 @@ ExitCode GenerateAndWriteSnapshotData(const SnapshotData** snapshot_data_ptr,
"Cannot open %s for writing a snapshot.\n",
snapshot_blob_path.c_str());
// TODO(joyeecheung): should be kStartupSnapshotFailure.
exit_code = ExitCode::kGenericUserError;
exit_code = ExitCode::kStartupSnapshotFailure;
}
return exit_code;
}
Expand All @@ -1193,7 +1193,7 @@ ExitCode LoadSnapshotDataAndRun(const SnapshotData** snapshot_data_ptr,
if (!ok) {
// If we fail to read the customized snapshot, simply exit with 1.
// TODO(joyeecheung): should be kStartupSnapshotFailure.
exit_code = ExitCode::kGenericUserError;
exit_code = ExitCode::kStartupSnapshotFailure;
return exit_code;
}
*snapshot_data_ptr = read_data.release();
Expand Down

0 comments on commit 057da6e

Please sign in to comment.