add task solution#509
Conversation
mateacademy-ai-mentor
left a comment
There was a problem hiding this comment.
Review Summary
Your implementation has two critical issues that violate explicit task requirements. First, the requirement specifies using console.error() for error reporting, but your code uses console.log(). This applies to all error paths - both the parameter validation error and the callback error. Second, you need to add a check comparing params[0] with params[1] before calling fs.cp - when they are identical, the app must do nothing as stated in the requirements. Without these fixes, your code doesn't meet the specification. Please update both the error logging method and add the same-location comparison logic.
✨ Please rate this review in the Platform's notification center1. I will be grateful for your feedback! ✨
Important
Fix the issues, commit the changes, and then re-request my review using the Re-request review button2 in the Reviewers tab.
Tip
If you have any comments about this review, please leave a message in the Add a comment section below and mention me with the @mateacademy-ai-mentor tag3.
I will read your message during my next review of your pull request. Please do not reply directly to my comments, as that feature is not supported yet.
Caution
Do not close the pull request until the review is complete. Closing it early can lead to unexpected behavior and disrupt the review process.
Footnotes
| const params = process.argv.slice(2); | ||
|
|
||
| if (params.length < 2) { | ||
| console.log(new Error('You need to write second parameter')); |
There was a problem hiding this comment.
The requirement explicitly states to throw an error using console.error(), not console.log(). Change console.log to console.error here.
| } else { | ||
| fs.cp(params[0], params[1], (error) => console.log(error)); |
There was a problem hiding this comment.
Missing check for same source and destination. The requirement states the app must do nothing when copying to the same location. You need to compare params[0] with params[1] before calling fs.cp.
| if (params.length < 2) { | ||
| console.log(new Error('You need to write second parameter')); | ||
| } else { | ||
| fs.cp(params[0], params[1], (error) => console.log(error)); |
There was a problem hiding this comment.
When an error occurs in the callback, it should be logged using console.error() per the requirements, not console.log().
mateacademy-ai-mentor
left a comment
There was a problem hiding this comment.
Review Summary
✨ Please rate this review in the Platform's notification center1. I will be grateful for your feedback! ✨
No description provided.