* @copyright 2007-2013 PrestaShop SA * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) * International Registered Trademark & Property of PrestaShop SA */ /** * @since 1.5.0 */ class PrestaShopExceptionCore extends Exception { /** * This method acts like an error handler, if dev mode is on, display the error else use a better silent way */ public function displayMessage() { header('HTTP/1.1 500 Internal Server Error'); if (_PS_MODE_DEV_ || defined('_PS_ADMIN_DIR_')) { // Display error message echo ''; echo '
';
foreach ($lines as $k => $l)
{
if ($offset + $k == $line - 1)
echo ''.($offset + $k).'. '.htmlspecialchars($l).'';
else
echo ($offset + $k).'. '.htmlspecialchars($l);
}
echo '';
foreach ($args as $arg => $value)
{
echo 'Argument ['.$arg."]\n";
print_r($value);
echo "\n";
}
echo '';
}
/**
* Log the error on the disk
*/
protected function logError()
{
$logger = new FileLogger();
$logger->setFilename(_PS_ROOT_DIR_.'/log/'.date('Ymd').'_exception.log');
$logger->logError($this->getExentedMessage(false));
}
/**
* Return the content of the Exception
* @return string content of the exception
*/
protected function getExentedMessage($html = true)
{
$format = '%s
at line %d in file %s