Errors and exceptions handling, #16

git-svn-id: svn+ssh://code.netmonsters.ru/svn/majestic/branches/evo@122 4cb57b5f-5bbd-dd11-951b-001d605cbbc5
This commit is contained in:
pzinovkin
2010-03-07 19:54:09 +00:00
parent 4f7e5b00bc
commit 5b7ad8e2ea
9 changed files with 57 additions and 17 deletions

View File

@ -19,6 +19,7 @@ class ErrorHandler
static public function error_handler($errno, $errstr, $errfile, $errline )
{
ob_clean();
throw new ErrorException($errstr, 0, $errno, $errfile, $errline);
return false;
}
@ -31,9 +32,9 @@ class ErrorHandler
$i++;
if($i >= $hiline - 10 && $i <= $hiline + 10) {
if ($i == $hiline) {
$code[] = '<tr class="error"><th>' . $i . '</th><td><span class="specific">' . $line . '</span></td></tr>';
$code[] = '<tr class="error"><th>' . $i . '</th><td><span class="specific">' . htmlentities($line, ENT_QUOTES, 'UTF-8') . '</span></td></tr>';
}else{
$code[] = '<tr><th>' . $i . '</th><td>' . $line . '</td></tr>';
$code[] = '<tr><th>' . $i . '</th><td>' . htmlentities($line, ENT_QUOTES, 'UTF-8') . '</td></tr>';
}
}
if($i > $hiline + 10) {
@ -50,6 +51,7 @@ class ErrorHandler
}
$text = '<table class="req"><thead><tr><th>Variable</th><th>Value</th></tr></thead><tbody>';
foreach ($array as $key => $value) {
$value = ($value) ? htmlentities($value, ENT_QUOTES, 'UTF-8') : '&nbsp;';
$text .= '<tr><td>' . $key . '</td><td class="code"><div>' . $value . '</div></td></tr>';
}
$text .= '</tbody></table>';
@ -139,7 +141,6 @@ class ErrorHandler
<pre class="exception_value">{$exception->getMessage()}</pre>
<table class="meta">
<tbody>
<tbody>
<tr><th>Request Method:</th><td>{$method}</td></tr>
<tr><th>Exception Type:</th><td>{$class}</td></tr>
<tr><th>Exception Message:</th><td><pre>{$exception->getMessage()}</pre></td></tr>