Added in internal error function, since the die() statements were hard to spot, and certainly not user friendly for the end user.

git-svn-id: file:///svn-source/pmgr/branches/yafr_20090716@498 97e9348a-65ac-dc4b-aefc-98561f571b83
This commit is contained in:
abijah
2009-08-06 20:17:02 +00:00
parent a69a56c715
commit d75cd10f49

View File

@@ -31,6 +31,39 @@
* You can also use this to include or require any files in your application. * You can also use this to include or require any files in your application.
* *
*/ */
function INTERNAL_ERROR($message) {
echo '<DIV class="internal-error" style="color:#000; background:#c22; padding:0.5em 1.5em 0.5em 1.5em;">';
echo '<H1 style="margin-bottom:0.2em">INTERNAL ERROR:</H1>';
echo '<H2 style="margin-top:0; margin-left:1.5em">' . $message . '</H2>';
echo '<H4>This error was not caused by anything that you did wrong.';
echo '<BR>It is a problem within the application itself and should be reported to the administrator.</H4>';
// Print out the entire stack trace
echo "<HR>Stack Trace:<OL>";
$trace = debug_backtrace(false);
for ($i = 0; $i < count($trace); ++$i) {
$bline = $trace[$i]['line'];
$bfile = $trace[$i]['file'];
$bfile = str_replace(ROOT.DS, '', $bfile);
$bfile = str_replace(CAKE_CORE_INCLUDE_PATH.DS, '', $bfile);
if ($i < count($trace)-1) {
$bfunc = $trace[$i+1]['function'];
$bclas = $trace[$i+1]['class'];
} else {
$bfunc = null;
$bclas = null;
}
echo("<LI>$bfile:$bline (" . ($bclas ? "$bclas::$bfunc" : "entry point") . ")</LI>\n");
}
echo '</OL>';
echo '</DIV>';
die();
}
/** /**
* The settings below can be used to set additional paths to models, views and controllers. * The settings below can be used to set additional paths to models, views and controllers.
* This is related to Ticket #470 (https://trac.cakephp.org/ticket/470) * This is related to Ticket #470 (https://trac.cakephp.org/ticket/470)