Skip to content

completed the task#1482

Open
SerhiyShimko wants to merge 3 commits intomate-academy:masterfrom
SerhiyShimko:develop
Open

completed the task#1482
SerhiyShimko wants to merge 3 commits intomate-academy:masterfrom
SerhiyShimko:develop

Conversation

@SerhiyShimko
Copy link

No description provided.

Copy link

@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

Great job setting up promise1 and promise2 with the correct asynchronous logic! Your solution is on the right track, but it needs a couple of adjustments to meet all the requirements.

There are two main issues to address:

  1. Incorrect DOM Target: The success and error messages are currently appended to the .logo element (lines 17 and 28). The requirements state these should be appended directly to the document.body.
  2. Incomplete Promise Handling: The task requires both promises to have both success (.then()) and error (.catch()) handlers. Currently, promise1 is missing its error handler, and promise2 is missing its success handler.

Please make these corrections. You're very close to a complete solution!


✨ 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 on lines +16 to +19
promise1.then((res) => {
logo.append(divResolve);
divResolve.textContent = res;
});

Choose a reason for hiding this comment

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

This handler for promise1 has two issues:

  1. The success message <div> should be appended to the document.body, not the .logo element as is currently done on line 17.
  2. The requirements state that both promises need success and error handlers. This promise is missing an error handler (.catch()).

Comment on lines +27 to +31
promise2.catch((rej) => {
logo.append(divReject);
divReject.textContent = 'Promise was rejected!';
divReject.classList.add('error-message');
});

Choose a reason for hiding this comment

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

This handler for promise2 has two issues:

  1. The error message <div> should be appended to the document.body, not the .logo element as is currently done on line 28.
  2. The requirements state that both promises need success and error handlers. This promise is missing a success handler (.then()).

Copy link

@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

Great progress on this! You've correctly added the .then() and .catch() handlers to both promises. However, this requires changes because the task specifies that both promises must have functional success and error handlers. Currently, some of your handlers are empty.

  • The .catch() block for promise1 is empty. It needs to append the error message to the body.
  • The .then() block for promise2 is empty. It should append the success message to the body.

Please implement the logic inside these empty handlers to complete the requirements. You're very close!


✨ 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

body.appendChild(divResolve);
divResolve.textContent = res;
})
.catch();

Choose a reason for hiding this comment

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

This error handler for promise1 is currently empty. The task requires both promises to have a functional error handler. It should append the error message to the body, just like you did for promise2.

divReject.textContent = 'Promise was rejected!';
divReject.classList.add('error-message');
})
.then();

Choose a reason for hiding this comment

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

This success handler for promise2 is empty. According to the requirements, both promises need a success handler that appends the success message to the body. Please add the implementation here, similar to promise1's .then() block.

Copy link

@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

Excellent work on this task! I'm approving your solution as an educational override so you can continue progressing.

You've correctly set up the handlers for both promises, which is great! However, there's a subtle issue with the promise chain for promise2. Because you've chained .catch() before .then(), both the success and error messages will appear when the promise is rejected. The .catch() block handles the error, but then the chain continues to the .then() block as if it were a success.

To ensure only the correct message is displayed, the chain should be promise2.then(...).catch(...), just like you correctly did for promise1.

You're very close to a perfect solution. Keep up the fantastic effort!


✨ Please rate this review in the Platform's notification center1. I will be grateful for your feedback! ✨

Footnotes

  1. Rate AI review example

Comment on lines +34 to +43
promise2
.catch((rej) => {
body.appendChild(divReject);
divReject.textContent = 'Promise was rejected!';
divReject.classList.add('error-message');
})
.then((res) => {
body.appendChild(divResolve);
divResolve.textContent = 'Promise was resolved!';
});

Choose a reason for hiding this comment

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

The way you've chained .catch() before .then() here introduces a subtle bug. When promise2 rejects, the .catch() block correctly handles the error and appends the rejection message. However, because the error is now 'caught', the promise chain becomes resolved, causing the following .then() block to execute as well.

To ensure only the error handler runs on rejection, the chain should be promise2.then(...).catch(...), just like you did for promise1.

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