<?php
// set_error_handler("handleErr");
class Error {
function dbErr($err_str) {
Error::showErr("Database Error:<br>$err_str <br>" . mysql_error());
}
function handleErr($errno, $errstr, $errfile, $errline) {
$s = $errstr;
$s .= "<br>Error Number: $errno";
$s .= "<br>File containing error: $errfile";
$s .= "<br>Line containing error: $errline";
Error::showErr($s);
}
// displays errors, whether PHP errors or errors thrown in
// my code to notify of undersirable behaviour
function showErr($err_str) {
// trace functions out of error
$cur_functions = debug_backtrace();
$content = "I'm sorry, there was an error in the code for this page.";
if ($err_str != "")
$content .= "<p>Text of error:<p>$err_str";
$content .= "<p>Current functions: ";
foreach ($cur_functions as $this_function) {
$content .= "<br>";
$content .= $this_function["function"];
}
$title="Error";
$content=$content;
$width=DEFAULT_ITEM_WIDTH;
$errBox = new TextBox($title, $content, $width);
$errBox->display();
die;
}
}
?>