public function caughtException($caller, $e)
{
$this->logCaughtException($e);
if (!$this->web_output) {
echo $this->public_error_message;
exit;
}
if (PHP_SAPI === 'cli') {
if (posix_isatty(STDOUT)) {
$red = "[0;31m";
$yellow = "[1;33m";
$end = "[0m";
} else {
$red = $end = $yellow = '';
}
if (isset($e->more_info)) {
echo '==[ ';
echo get_class($e) . ': ' . $red . $e->getMessage() . $end . " ]===========\n\n";
echo "Additional information:\n" . $this->print_r($e->more_info, '', '', $yellow . '* ' . $end, "\n", ' ');
} else {
echo $red . $e->getMessage() . $end . "\n";
}
exit($e->getCode() ?: 255);
}
if (method_exists($e, 'getHTML')) {
?>
<!DOCTYPE html>
<html lang="en"><head>
<title>Exception: <?php
echo htmlspecialchars($e->getMessage());
?>
</title>
<head><body>
<?php
echo $e->getHTML();
?>
</body></head>
<?php
exit;
}
if ($_GET[$this->name . '_debug'] == 'rendertree') {
echo '<h2>Object Tree</h2>';
try {
$this->showRenderTree($e, $this->app);
} catch (Exception $e) {
echo '<h1>Exception while trying to render tree:</h1>';
//unset($_GET[$htis->name.'_debug']);
//$this->app->caughtException($e);
}
}
$o = '';
$o .= '<h2>Application Error: ' . htmlspecialchars($e->getMessage()) . "</h2>\n";
$o .= '<p><font color=red>' . get_class($e) . ', code: ' . $e->getCode() . '</font></p>';
if (@$e->more_info) {
$o .= '<p>Additional information:';
$o .= $this->print_r($e->more_info, '<ul>', '</ul>', '<li>', '</li>', ' ');
$o .= '</p>';
}
if (method_exists($e, 'getMyFile')) {
$o .= '<p><font color=blue>' . $e->getMyFile() . ':' . $e->getMyLine() . '</font></p>';
}
if (method_exists($e, 'getMyTrace')) {
$o .= $this->backtrace(3, $e->getMyTrace());
} else {
$o .= $this->backtrace(@$e->shift, $e->getTrace());
}
if ((isset($_POST['ajax_submit']) || $_SERVER['HTTP_X_REQUESTED_WITH'] == 'XMLHttpRequest') && !$_GET['cut_page'] && !$_GET['cut_object'] && !$_GET['cut_region']) {
$this->displayError($o);
} else {
echo $o;
}
if (@$e->by_exception) {
echo '<h3>This error was triggered by the following error:</h3>';
$this->caughtException($caller, $e->by_exception);
}
echo "<p>Note: To hide this information from your users, add \$config['logger']['web_output']=false to your " . "config.php file. Refer to documentation on 'Logger' for alternative logging options</p>";
exit;
}