Skip to content

finish#1536

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

finish#1536
IronHedgehog wants to merge 2 commits into
mate-academy:masterfrom
IronHedgehog:develop

Conversation

@IronHedgehog
Copy link
Copy Markdown

Copy link
Copy Markdown

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

Choose a reason for hiding this comment

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

Review Summary

Your implementation creates both promises correctly, but fails to meet the core requirement that each promise must have both success and error handlers. Currently, you only attach .then() to promise1 and .catch() to promise2 — each promise is missing the opposite handler. Critical issues that must be fixed: 1. Add .catch() to promise1: It currently only has .then(). Even though promise1 resolves successfully, the requirement states handlers for "both promises" — this means both .then() and .catch() on each. 2. Add .then() to promise2: It currently only has .catch(). Even though promise2 rejects, it still requires a success handler per the "both promises" requirement. 3. Fix error display: In your catch handler, message is an Error object. Setting div.textContent = message will display [object Object]. Use message.message to get the actual error text string. These are blockers because the checklist explicitly requires "success and error handlers for both promises" — this is a core functional requirement, not optional.


✨ 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 Outdated
Comment on lines +17 to +24

promise1.then((message) => {
const div = document.createElement('div');

div.classList.add('message');
div.textContent = message;
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.

Requirement #4 states handlers should be added for 'both promises'. Currently promise1 only has .then() but no .catch() handler. Add promise1.catch() with the same error div creation logic.

Comment thread src/scripts/main.js
Comment on lines +25 to +31

promise2.catch((message) => {
const div = document.createElement('div');

div.classList.add('message', 'error-message');
div.textContent = message;
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.

promise2 needs a .then() success handler in addition to .catch(). Even though promise2 rejects, it still requires a success handler per the 'both promises' requirement.

Comment thread src/scripts/main.js Outdated
const div = document.createElement('div');

div.classList.add('message', 'error-message');
div.textContent = message;
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

The reject() call passes an Error object, but setting div.textContent = message will display '[object Object]' instead of the error text. Use message.message or message.toString() to get the actual error text.

Copy link
Copy Markdown

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

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 approved and meets all requirements. Both promise1 and promise2 are correctly implemented with proper event listeners and timeout logic, and both have the required .then() and .catch() handlers attached. The success and error handlers properly create the message divs with the correct text content, and the error handler correctly accesses error.message. All checklist items pass, and no test failures are reported. Great work on resolving the previous review feedback.


✨ 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