How to die Magento immediately when getting an exception?
I got a problem when try to get a helper
:
Mage::helper('providers')
In fact, the provider helper
is not exist.
But it just out an exception and save it into the file: var/log/exception.log
and everything is ok, except I could not see the interface which I want.
I need a way to do if I got any exception, Magento wi开发者_如何学Pythonll exit immediately and show the messages on the browser.
Turn on developer mode, and make sure PHP is showing errors.
Open up index.php
and change this
if (isset($_SERVER['MAGE_IS_DEVELOPER_MODE'])) {
Mage::setIsDeveloperMode(true);
}
#ini_set('display_errors', 1);
To this
#if (isset($_SERVER['MAGE_IS_DEVELOPER_MODE'])) {
Mage::setIsDeveloperMode(true);
#}
ini_set('display_errors', 1);
With developer mode on Exceptions will halt execution instead of being logged.
Also, you could skip comment the if block out by adding the apache environmental variable to MAGE_IS_DEVELOPER_MODE
to your .htaccess
file and setting it to 1.
Try wrapping the call in a try catch block, i.e.
try {
Mage::helper('providers');
}
catch (Exception $e){
echo $e;
}
精彩评论