// Improve exception display
This commit is contained in:
1 parent
53d858fa2a
commit
ae8fb39818
1 file changed
+4
-2
@@ -58,6 +58,8 @@ class PrestashopExceptionCore extends Exception
|
|||||||
ltrim(str_replace(array(_PS_ROOT_DIR_, '\\'), array('', '/'), $this->getFile()), '/')
|
ltrim(str_replace(array(_PS_ROOT_DIR_, '\\'), array('', '/'), $this->getFile()), '/')
|
||||||
);
|
);
|
||||||
|
|
||||||
|
$this->displayFileDebug($this->getFile(), $this->getLine());
|
||||||
|
|
||||||
// Display debug backtrace
|
// Display debug backtrace
|
||||||
echo '<ul>';
|
echo '<ul>';
|
||||||
foreach ($this->getTrace() as $id => $trace)
|
foreach ($this->getTrace() as $id => $trace)
|
||||||
@@ -96,7 +98,7 @@ class PrestashopExceptionCore extends Exception
|
|||||||
* @param int $line
|
* @param int $line
|
||||||
* @param string $id
|
* @param string $id
|
||||||
*/
|
*/
|
||||||
protected function displayFileDebug($file, $line, $id)
|
protected function displayFileDebug($file, $line, $id = null)
|
||||||
{
|
{
|
||||||
$lines = file($file);
|
$lines = file($file);
|
||||||
$offset = $line - 6;
|
$offset = $line - 6;
|
||||||
@@ -108,7 +110,7 @@ class PrestashopExceptionCore extends Exception
|
|||||||
}
|
}
|
||||||
$lines = array_slice($lines, $offset, $total);
|
$lines = array_slice($lines, $offset, $total);
|
||||||
|
|
||||||
echo '<div class="psTrace" id="psTrace_'.$id.'"><pre>';
|
echo '<div class="psTrace" id="psTrace_'.$id.'" '.((is_null($id) ? 'style="display: block"' : '')).'><pre>';
|
||||||
foreach ($lines as $k => $l)
|
foreach ($lines as $k => $l)
|
||||||
{
|
{
|
||||||
if ($offset + $k == $line - 1)
|
if ($offset + $k == $line - 1)
|
||||||
|
|||||||
Reference in new issue
Block a user