add solution#374
Conversation
mateacademy-ai-mentor
left a comment
There was a problem hiding this comment.
Review Summary
I am requesting changes because there is a functional error in the error-handling path that can hide runtime problems from the user. In src/app.js, your main().catch(e => console.error(e.massage)) line uses e.massage instead of e.message, so any thrown error will log undefined instead of the actual error message; this breaks the expected behavior of a CLI tool that should clearly report failures. Please change this to either e.message or log the whole error object so users can see what went wrong.
Additionally, inside main you catch the error and then rethrow it, while also having the outer main().catch(...) handler; this duplication can make control flow confusing and, in some environments, may lead to unhandled rejections. You should either handle and log errors inside main and remove the outer .catch, or remove the inner try/catch and let errors propagate to the single .catch at the call site. Apart from these issues, your core move/rename logic for all the specified mv-like scenarios looks solid and aligned with the requirements, so once the error handling is corrected your solution will be in good shape.
✨ 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
| } | ||
|
|
||
| // eslint-disable-next-line no-console | ||
| main().catch((e) => console.error(e.massage)); |
There was a problem hiding this comment.
e.massage is a typo; this will always print undefined instead of the actual error message, so the user won’t see what went wrong. Use e.message (or log the whole error) to show the error correctly.
| } catch (e) { | ||
| throw e; |
There was a problem hiding this comment.
Rethrowing the error here is redundant because you already have main().catch(...) below; consider either handling errors here and not catching below, or letting them bubble up and only handling them in one place.
mateacademy-ai-mentor
left a comment
There was a problem hiding this comment.
Review Summary
I am approving your solution because it correctly implements the required mv-like behavior and handles all the specified scenarios. Your code properly distinguishes between destination paths that are directories (including those ending with /) and those that should be treated as file paths for renaming. It also validates that required directories exist, moves the file contents, and removes the source file afterward, which aligns with the task’s core requirements. Error handling is centralized via the top-level .catch, and logging e.message ensures clear, user-friendly error output without redundant try/catch blocks. While there are always possible refinements (for example, using fs.rename for a more direct move operation), these are non-blocking improvements and not required by the task. Overall, your implementation is clear, coherent, and meets the functional and technical expectations for this exercise.
✨ Please rate this review in the Platform's notification center1. I will be grateful for your feedback! ✨
No description provided.