* @copyright 2007-2015 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) {
$string = ($offset + $k).'. '.htmlspecialchars($l);
if ($offset + $k == $line) {
echo ''.$string.'';
} else {
echo $string;
}
}
echo '';
foreach ($args as $arg => $value) {
echo 'Argument ['.Tools::safeOutput($arg)."]\n";
echo Tools::safeOutput(print_r($value, true));
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->getExtendedMessage(false));
}
/**
* @deprecated 1.5.5
*/
protected function getExentedMessage($html = true)
{
Tools::displayAsDeprecated();
return $this->getExtendedMessage($html);
}
/**
* Return the content of the Exception
* @return string content of the exception
*/
protected function getExtendedMessage($html = true)
{
$format = '%s
at line %d in file %s