Handling Magento errors

20. Januar 2015 at 09:35

magento ecommerce logo

Magento ships with a new feature, which effectively hides errors from your visitors. If some kind of error occurs – a PHP Fatal Error, or PHP Notice Error, or database error – the actual error is written to file and not shown on screen. But when developing Magento sites, this behaviour might actually become annoying. Luckily you can easily re-enable the error-displaying again.

Showing errors anyway

Displaying the error on screen is much easier to work with. To enable the error-displaying again, navigate to the errors-folder in the Magento root, and rename the file local.xml.sample to local.xml. The XML-file should contain a line similar to this:

 <skin>myskin</skin> 

You can see that the action here is configured to print the message on screen, while the original dump is also left on the filesystem (in var/cache). You could also change the XML-code a bit to remove the dump-file instead:

 <trash>delete</trash> 

Mail me if an error occurs

Even cooler is that the XML-code also allows you to define an email-address to which mail should be sent if some error occurs:

<config>
<skin>default</skin>
<report>
<action>email</action>
<subject>Whoops, something went wrong in Magento</subject>
<email_address>info@example.com</email_address>
<trash>delete</trash>
</report>
</config>

Those of you who have wondered why errors were displayed using the original skin, can also see that the skin can be changed as well here:

<skin>myskin</skin>

Hope you find this all usefull.

Please share this article von facebook & google plus or where you want, thank you!

GD Star Rating
loading...
GD Star Rating
loading...
Handling Magento errors, 10.0 out of 10 based on 3 ratings