Skip to content

solution#1537

Open
Tanya-sktr wants to merge 2 commits into
mate-academy:masterfrom
Tanya-sktr:develpp
Open

solution#1537
Tanya-sktr wants to merge 2 commits into
mate-academy:masterfrom
Tanya-sktr:develpp

Conversation

@Tanya-sktr

Copy link
Copy Markdown

No description provided.

@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 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:

  1. promise1 is missing an error handler — add .catch() to handle rejection cases. When promise1 is rejected (which can happen if .logo doesn't exist or other errors occur), the error needs to be caught and displayed as <div class="message error-message">Promise was rejected!</div>.

  2. 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

  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 +23
promise1.then(() => {
const message = document.createElement('div');

message.classList.add('message');
message.textContent = `Promise was resolved!`;
document.body.append(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.

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.

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

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

message.classList.add('message', 'error-message');
message.textContent = `Promise was rejected!`;
document.body.append(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.

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

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