In the current implementation, the REPL commands such as .save and .load accept a filePath as arguments.
It would greatly improve user experience if we could validate these arguments to prevent attempts to save or load files with empty filenames.
In case the file is an empty string, we should print the error message, show the prompt to the user and return.
ERR_MISSING_ARGS would be a good fit here to frame the message.
Eg: const { message } = new ERR_MISSING_ARGS('file');
String values like 0, false, null, undefined etc are still a valid filenames and good to write some unit tests for this.
In the current implementation, the REPL commands such as .save and .load accept a filePath as arguments.
It would greatly improve user experience if we could validate these arguments to prevent attempts to save or load files with empty filenames.
In case the
fileis an empty string, we should print the error message, show the prompt to the user andreturn.ERR_MISSING_ARGSwould be a good fit here to frame the message.Eg:
const { message } = new ERR_MISSING_ARGS('file');String values like
0,false,null,undefinedetc are still a valid filenames and good to write some unit tests for this.