promise#1533
Conversation
masteryada378
commented
May 7, 2026
- DEMO LINK
mateacademy-ai-mentor
left a comment
There was a problem hiding this comment.
Review Summary
Your implementation has functional issues that need fixing. The main problem is in your .catch() handlers - you're passing the entire Error object to createMessage() instead of extracting the message text. This causes [object Error] to display instead of Promise was rejected!. Fix by using err.message in your catch callbacks. Additionally, there's a chaining issue with promise2 - when you call .then() followed by .catch(), both handlers can execute if the promise rejects, which means the success handler will incorrectly display text before the catch handler. Make sure to return the promise from .catch() or use proper promise chaining so handlers don't overlap.
✨ 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
| promise2 | ||
| .then((msg) => createMessage(msg)) |
There was a problem hiding this comment.
The .then() handlers will display whatever value is passed to resolve() or reject(). For promise2, since it never resolves, the .then() won't run - the .catch() will. However, the .catch() receives an Error object, not a string, causing [object Error] to be displayed instead of the actual message.
| .catch((err) => createMessage(err, true)); | ||
|
|
||
| promise2 | ||
| .then((msg) => createMessage(msg)) |
There was a problem hiding this comment.
This .catch() receives an Error object. When passed to createMessage(), it becomes [object Error] instead of Promise was rejected!. Should pass err.message to get the actual error text.
| }); | ||
|
|
||
| promise1 | ||
| .then((msg) => createMessage(msg)) |
There was a problem hiding this comment.
Similar issue - the .catch() receives an Error object. Should pass err.message to get the actual error text.
mateacademy-ai-mentor
left a comment
There was a problem hiding this comment.
Review Summary
Your implementation meets all requirements successfully. Both promise1 and promise2 are correctly created with new Promise(), the first resolves on .logo click using { once: true }, and the second rejects after 3 seconds using setTimeout. Each promise has proper .then() and .catch() handlers that append the exact message divs as specified, with the error handler correctly using the error-message class and passing err.message to your createMessage function. The code is clean, functional, and all checklist items have been verified. Great work!
✨ Please rate this review in the Platform's notification center1. I will be grateful for your feedback! ✨