Magento 1 Tutorials Magento Exception Printing is Disabled by Default for Security Reasons

First Published: April 8, 2011

Magento 1 Exception Printing

From Magento 1.4 onwards, the way errors/exceptions were handled changed quite a lot. Previously, Magento would automatically redirect the user to an error page, which looked ugly and was definitely a security risk (although less so than a lot of people make out). Now, the user is still redirected to an ugly error page (a tutorial on how to style this will be available shortly), but the error message is hidden. From a security stand point, this is great but as a developer, it is important to know what errors occur on the site.

To change the way errors/exceptions are handled in Magento, rename errors/local.xml.sample to errors/local.xml. If you open this file and have a play around, it explains how to easily change the Magento error functionality so that all errors are hidden but emailed to an email of your choosing. This is a much better system for catching errors without reporting them to the whole world.

Magento 2 Exception Printing

Exceptions in Magento 2 are handled in a very similar way to Magento 1. By default they are hidden but can easily be revealed.

To reveal the full error message in Magento 2, find the pub/errors/local.xml.sample file and rename it to local.xml. If you refresh your error page, you should now see the full error message. If you open this file and have a play around, it explains how to easily change the Magento error functionality so that all errors are hidden but emailed to an email of your choosing.