Skip to content

add task solution#1546

Open
zarubina20 wants to merge 2 commits into
mate-academy:masterfrom
zarubina20:develop
Open

add task solution#1546
zarubina20 wants to merge 2 commits into
mate-academy:masterfrom
zarubina20:develop

Conversation

@zarubina20

Copy link
Copy Markdown

js_promise_basic_DOM

@mateacademy-ai-mentor mateacademy-ai-mentor left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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

  1. Rate AI review example

  2. Re-request AI review example

  3. Add AI review comments example

Comment thread src/scripts/main.js
Comment on lines +10 to +17
promise1.then(() => {
const div = document.createElement('div');

div.className = 'message';

div.textContent = 'Promise was resolved!';

document.body.appendChild(div);

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

promise1 is missing an error handler (.catch()). Requirement #4 states both promises need success AND error handlers.

Comment thread src/scripts/main.js
Comment on lines +20 to +23
const promise2 = new Promise((resolve, reject) => {
setTimeout(() => reject(new Error('Timed out')), 3000);
});

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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 mateacademy-ai-mentor left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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! ✨

Footnotes

  1. Rate AI review example

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants