add task solution#1546
Conversation
mateacademy-ai-mentor
left a comment
There was a problem hiding this comment.
Review Summary
Your implementation is missing required handlers per CHECKLIST ITEM #4, which explicitly requires both promises to have BOTH success AND error handlers. Currently, promise1 only has .then() but is missing .catch() to handle rejections, and promise2 only has .catch() but is missing .then() to handle successful resolution. This is a critical gap because if promise1 were to ever reject (even if not expected), the rejection would be unhandled, and if promise2 were to resolve, no success message would appear. Add the missing handlers to both promises - promise1 needs a .catch() that appends the error-message div, and promise2 needs a .then() that appends the success-message div. The core promise mechanics are correct, so this fix should be straightforward.
✨ 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); |
There was a problem hiding this comment.
promise1 is missing an error handler (.catch()). Requirement #4 states both promises need success AND error handlers.
| const promise2 = new Promise((resolve, reject) => { | ||
| setTimeout(() => reject(new Error('Timed out')), 3000); | ||
| }); | ||
|
|
There was a problem hiding this comment.
promise2 is missing a success handler (.then()). Requirement #4 states both promises need success AND error handlers. The .catch() on line 23 handles errors, but promise2 also needs a .then() for when it resolves (if ever called).
mateacademy-ai-mentor
left a comment
There was a problem hiding this comment.
Review Summary
Your implementation correctly satisfies all requirements. Both promise1 and promise2 have proper success handlers (.then()) and error handlers (.catch()) as required by the checklist. The promise1 correctly resolves on .logo click using { once: true }, while promise2 properly rejects after 3 seconds using setTimeout. The DOM manipulation for both success and error outcomes appends the appropriate message divs to the body. All core functionality is working as expected, and no blocking issues were identified.
✨ Please rate this review in the Platform's notification center1. I will be grateful for your feedback! ✨
js_promise_basic_DOM