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

add task solution #237

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open

Conversation

mykhailonl
Copy link

No description provided.

Copy link

@mateacademy-ai-mentor mateacademy-ai-mentor left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Great job on implementing the moveFile function! 🎉 Your code meets the task requirements and constraints effectively. While there are a few suggestions for improving error messages and user feedback, these are minor and do not impact the functionality. Keep up the good work, and consider refining those messages for an even better user experience in the future! 😊

✨ Please rate this review in the Platform's notification center. I will be grateful for your feedback! ✨

if (fs.existsSync(moveTo)) {
targetIsDirectory = fs.lstatSync(moveTo).isDirectory();
} else if (moveTo.endsWith('/')) {
console.error('Error: Destination directory does not exist');

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Consider using console.log instead of console.error for user feedback messages that are not actual errors, like informing the user that a directory does not exist.


fs.rename(targetFile, destinationPath, (err) => {
if (err) {
console.error('Error happened during the rename operation:', err);

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's good to provide detailed error messages, but consider adding more context to the error message to help users understand what might have gone wrong.

const params = process.argv.slice(2);

if (params.length < 2) {
console.error('No params provided');

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The message 'No params provided' might be misleading if one parameter is provided. Consider changing it to 'Insufficient parameters provided' to clarify the issue.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants