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 Dec 13, 2022
1 parent 0429774 commit bc5f1de
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 @@ -48,6 +48,7 @@ const {
exitCodes: {
kGenericUserError,
kNoFailure,
kInvalidCommandLineArgument,
},
} = internalBinding('errors');

Expand Down Expand Up @@ -344,7 +345,7 @@ function startInspect(argv = ArrayPrototypeSlice(process.argv, 2),
console.error(` ${invokedAs} --port=<port>`);
console.error(` ${invokedAs} -p <pid>`);
// 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 @@ -1108,7 +1108,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 @@ -1142,7 +1142,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 @@ -1166,7 +1166,7 @@ ExitCode LoadSnapshotDataAndRun(const SnapshotData** snapshot_data_ptr,
if (!SnapshotData::FromBlob(read_data.get(), fp)) {
// 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 bc5f1de

Please sign in to comment.