solution#1537
Conversation
mateacademy-ai-mentor
left a comment
There was a problem hiding this comment.
Review Summary
Your code creates both promises correctly and implements the basic click/rejection functionality, but the requirements explicitly state "add success and error handlers for both promises," and this checklist item is not satisfied.
Critical issues that must be fixed:
-
promise1 is missing an error handler — add
.catch()to handle rejection cases. When promise1 is rejected (which can happen if.logodoesn't exist or other errors occur), the error needs to be caught and displayed as<div class="message error-message">Promise was rejected!</div>. -
promise2 is missing a success handler — add
.then()to handle successful resolution. When promise2 resolves after 3 seconds, it should display<div class="message">Promise was resolved!</div>.
Each promise should have a complete chain: promise.then(successHandler).catch(errorHandler) or vice versa.
This is a straightforward fix but blocks compliance with the explicit requirement. Once both handlers are added to each promise, the implementation will be complete.
✨ 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 message = document.createElement('div'); | ||
|
|
||
| message.classList.add('message'); | ||
| message.textContent = `Promise was resolved!`; | ||
| document.body.append(message); | ||
| }); |
There was a problem hiding this comment.
promise1 is missing an error handler. The requirement states 'add success and error handlers for both promises'. Add .catch() to handle rejection cases for promise1.
|
|
||
| promise2.catch(() => { | ||
| const message = document.createElement('div'); | ||
|
|
||
| message.classList.add('message', 'error-message'); | ||
| message.textContent = `Promise was rejected!`; | ||
| document.body.append(message); | ||
| }); |
There was a problem hiding this comment.
promise2 is missing a success handler. The requirement states 'add success and error handlers for both promises'. Add .then() to handle successful resolution cases for promise2.
mateacademy-ai-mentor
left a comment
There was a problem hiding this comment.
Review Summary
Your implementation successfully meets all core requirements. Both promises have complete handler chains, the .logo click correctly resolves promise1, and promise2 properly rejects after 3 seconds. The success and error handlers both append the correct HTML elements with the specified text to the body. As a minor improvement, consider fixing the typo succesMessage to successMessage for better code readability—while this doesn't affect functionality, clean variable naming helps with code maintenance.
✨ Please rate this review in the Platform's notification center1. I will be grateful for your feedback! ✨
No description provided.