solution#1517
Conversation
Ruslan-oss-max0
commented
Apr 16, 2026
- DEMO LINK
mateacademy-ai-mentor
left a comment
There was a problem hiding this comment.
Review Summary
I am requesting changes because the current implementation does not fully meet the checklist requirement that each promise must have both a success and an error handler. In src/scripts/main.js, promise1 is only followed by a .then(...) and is missing a .catch(...) that appends <div class="message error-message">Promise was rejected!</div> to document.body [CHECKLIST ITEM #4, #7]. Similarly, promise2 currently has only a .catch(...) but must also have a .then(...) that appends <div class="message">Promise was resolved!</div> to document.body, even though this promise will reject in practice [CHECKLIST ITEM #4, #6]. These missing handlers are critical because the task explicitly requires both success and error handlers for each promise, not just one type per promise.
To fix this, attach a .catch(...) to promise1 right after its .then(...) chain, and inside that handler create/append the required error-message <div> to document.body. Then, attach a .then(...) to promise2 (before or in the same chain as the existing .catch(...)) that creates/appends the required resolved <div class="message"> to document.body. Once these handlers are added, your logic for resolving on .logo click and rejecting after 3 seconds will be complete and aligned with the checklist. Aside from these handler gaps, the core behaviors you've implemented look good, and you’re very close—fixing these points should bring your solution to full compliance.
✨ 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
| promise1.then(() => { | ||
| const div = document.createElement('div'); | ||
|
|
||
| div.className = 'message'; | ||
| div.textContent = 'Promise was resolved!'; | ||
| document.body.appendChild(div); | ||
| }); |
| promise2.catch(() => { | ||
| const div = document.createElement('div'); | ||
|
|
||
| div.classList.add('message', 'error-message'); | ||
| div.textContent = 'Promise was rejected!'; | ||
| document.body.appendChild(div); | ||
| }); |
There was a problem hiding this comment.
Missing success handler for promise2. Checklist items #4 and #6 require both success and error handlers for each promise; add a .then to promise2 that appends <div class="message">Promise was resolved!</div> to document.body (even though this promise will reject in practice, the handler still must be present).
mateacademy-ai-mentor
left a comment
There was a problem hiding this comment.
Review Summary
Your solution is approved because it correctly implements both required promises and their handlers in src/scripts/main.js, matching the task’s functional requirements. promise1 resolves on a .logo click and promise2 rejects after 3 seconds, and in both cases you append the exact required DOM elements (<div class="message">Promise was resolved!</div> and <div class="message error-message">Promise was rejected!</div>), so the core behavior and checklist items are satisfied. There are no critical blockers: the code should run and pass the tests as-is.
One minor improvement: where you call document.querySelector('.logo') near the top of src/scripts/main.js, it would be safer to ensure the element exists before attaching the event listener or to run this logic after DOMContentLoaded, e.g. wrapping the setup in document.addEventListener('DOMContentLoaded', ...) or checking if (logo) { logo.addEventListener(...); }. This isn’t required for task completion but will make your code more robust if the script runs before the DOM is fully loaded or on a page without .logo. Overall, you met the task requirements well and the promise usage and DOM manipulation are clear and correct—nice work.
✨ Please rate this review in the Platform's notification center1. I will be grateful for your feedback! ✨