-
Notifications
You must be signed in to change notification settings - Fork 9.3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fix email not sent when sitemap generation has errors #11320
Fix email not sent when sitemap generation has errors #11320
Conversation
The lines were a reminiscence from when the translation logic was in the core module. The logic was replaced with the correct use of the inlineTranslation property that is also present at the end of the method.
@marinagociu Thank you for contribution. Please fix failed unit tests (see Travis builds). Actually, unit tests duplicate the error from code so it expects that exception is thrown. |
@vkublytskyi, I think I need you input and help on this as I'm not sure how to proceed. As far as I see it the unit test that fails should be removed since the method should not throw an exception, but instead it should send the exception messages by email. Can you confirm this? Should I remove that test, or replace it with another one? If so, with what kind of test should I replace it? Thanks! |
@marinagociu It should be enough just to fix failed unit test:
You may also face the issue caused by fact that observer use method chaining on transport builder. So you will need to mock all methods to return |
@vkublytskyi thank you so much for you help! I've updated the unit test with the suggested changes. |
Magento/Sitemap/Model/Observer.php => will be fixed by open PR magento#11320
Description
This PR changes the logic for handling errors in the sitemap generation cron. If an exception is thrown when trying to generate any of the sitemaps, the processes is not stopped anymore, but instead the errors are sent by email based on the XML Sitemap configuration. The old
_translateModel
property is not used anymore, and the inline translation is correctly suspended using theinlineTranslation
property instead.Fixed Issues (if relevant)
Manual testing scenarios
error
at the first sitemap that could not be generated and the exception message was saved in on the cron task in the message field.Contribution checklist