Better error handling/displaying with $config['debug'] and $config['verbose_errors']

This commit is contained in:
Michael Foster 2013-08-03 00:22:28 -04:00
parent 62f8ea4813
commit 1d37e81ade
5 changed files with 49 additions and 19 deletions

View file

@ -57,7 +57,7 @@ function createBoardlist($mod=false) {
);
}
function error($message, $priority = true) {
function error($message, $priority = true, $debug_stuff = false) {
global $board, $mod, $config;
if ($config['syslog'] && $priority !== false) {
@ -71,16 +71,16 @@ function error($message, $priority = true) {
}
die(Element('page.html', array(
'config'=>$config,
'title'=>_('Error'),
'subtitle'=>_('An error has occured.'),
'body'=>'<center>' .
'<h2>' . _($message) . '</h2>' .
(isset($board) ?
"<p><a href=\"" . $config['root'] .
($mod ? $config['file_mod'] . '?/' : '') .
$board['dir'] . $config['file_index'] . "\">"._("Go back")."</a>.</p>" : '') .
'</center>'
'config' => $config,
'title' => _('Error'),
'subtitle' => _('An error has occured.'),
'body' => Element('error.html', array(
'config' => $config,
'message' => $message,
'mod' => $mod,
'board' => isset($board) ? $board : false,
'debug' => is_array($debug_stuff) ? str_replace("\n", '&#10;', utf8tohtml(print_r($debug_stuff, true))) : utf8tohtml($debug_stuff)
))
)));
}