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
Better error handling for issues during bulk attribute update #1434
Better error handling for issues during bulk attribute update #1434
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I just would suggest to keep Exception handling for backward compatibility, i.e.
catch (Throwable $e) {
Mage::logException($e);
$this->_getSession()->addException($e, $this->__('An error occurred while updating the product(s) attributes.'));
} catch (Exception $e) {
$this->_getSession()->addException($e, $this->__('An error occurred while updating the product(s) attributes.'));
@jouriy your suggestion does not make much sense. Magento 1 was written at a time when Exception was the most generic thing to catch. Since PHP7 this has become Throwable, so I’m pretty sure this is what was originally meant. |
Thank you for the details. The reason why I suggested it was my impression that 1.9.4.x branch is supposed to be backward compatible with Magento 1.9.x (and drop-in replacement) which is still mostly on PHP 5.6, so removing Exception handling means no any error reporting for 5.x.
Should not we create a new PR than to bring better error handing for all cases? |
app/code/core/Mage/Adminhtml/controllers/Catalog/Product/Action/AttributeController.php
Outdated
Show resolved
Hide resolved
I updated the code as per @colinmollenhour suggestion. |
Ahh I just remembered that |
@colinmollenhour I don’t follow. What are you trying to say? Okay, I think you are referring to \Mage_Core_Model_Session_Abstract::addException(), except this isn't quite the same. This does log the exception, but using Mage::log() and a custom message. Not using Mage::logException(). For me this isn't acceptable because we use special exception tracking and for that to work everything needs to go through Mage::logException() which is what Magento normally does. I've changed my code for a better solution that does not log twice anymore. |
I also created #1443 where I change the superfluous handing of the Exception in Mage_Core_Model_Session_Abstract::addException() Magento seams to have forgotten about it's own Mage::logException(). Why they would ever format their own string and pass it to Mage::log() is beyond me. |
Should I also move this to branch 20.0 ? |
All requested changes have been implemented by the author
If something goes wrong during mass product attribute update, the admin gets a generic message and there is no error in the log, making it harder to debug this issue.