Added support for additional debug output if a critical error occurs

(For example during a database operation)
This commit is contained in:
Andre Lorbach 2011-09-30 11:33:35 +02:00
parent 0834990799
commit b2a37779ae
2 changed files with 32 additions and 4 deletions

View File

@ -1034,6 +1034,7 @@ function DieWithErrorMsg( $szerrmsg )
}
else if ( $RUNMODE == RUNMODE_WEBSERVER )
{
// Print main error!
print (
"<html><title>Adiscon LogAnalyzer :: Critical Error occured</title><head>" .
"<link rel=\"stylesheet\" href=\"" . $gl_root_path . "themes/default/main.css\" type=\"text/css\"></head><body><br><br>" .
@ -1044,7 +1045,20 @@ function DieWithErrorMsg( $szerrmsg )
"<tr><td class=\"cellmenu1_naked\" align=\"left\">Errordetails:</td>" .
"<td class=\"tableBackground\" align=\"left\"><br>" .
$szerrmsg .
"<br><br></td></tr></table>" .
"<br><br></td></tr></table>");
// Print Detail error's if available
if ( isset($content['detailederror']) )
{
print ("<table width=\"600\" align=\"center\" class=\"with_border_alternate ErrorMsg\" cellpadding=\"2\"><tr>".
"<tr><td class=\"cellmenu1_naked\" align=\"left\">Additional Errordetails:</td>" .
"<td class=\"tableBackground\" align=\"left\"><br>" .
$content['detailederror'] .
"<br><br></td></tr></table>");
}
// End HTML Body
print(
"</body></html>"
);
}

View File

@ -211,12 +211,13 @@ function DB_ReturnSimpleErrorMsg()
function DB_PrintError($MyErrorMsg, $DieOrNot)
{
global $n,$HTTP_COOKIE_VARS, $errdesc, $errno, $linesep;
global $content, $n,$HTTP_COOKIE_VARS, $errdesc, $errno, $linesep;
$errdesc = mysql_error();
$errno = mysql_errno();
// Define global variable so we know an error has occured!
if ( !defined('PHPLOGCON_INERROR') )
define('PHPLOGCON_INERROR', true);
$errormsg="Database error: $MyErrorMsg $linesep";
@ -229,7 +230,20 @@ function DB_PrintError($MyErrorMsg, $DieOrNot)
if ($DieOrNot == true)
DieWithErrorMsg( "$linesep" . $errormsg );
else
{
OutputDebugMessage("DB_PrintError: $errormsg", DEBUG_ERROR);
if ( !isset($content['detailederror']) )
{
$content['detailederror_code'] = ERROR_DB_QUERYFAILED;
$content['detailederror'] = GetErrorMessage(ERROR_DB_QUERYFAILED);
}
else
$content['detailederror'] .= "<br><br>" . GetErrorMessage(ERROR_DB_QUERYFAILED);
// Append SQL Detail Error
$content['detailederror'] .= "<br><br>" . $errormsg;
}
}
function DB_RemoveParserSpecialBadChars($myString)