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,7 +1034,8 @@ function DieWithErrorMsg( $szerrmsg )
} }
else if ( $RUNMODE == RUNMODE_WEBSERVER ) else if ( $RUNMODE == RUNMODE_WEBSERVER )
{ {
print( // Print main error!
print (
"<html><title>Adiscon LogAnalyzer :: Critical Error occured</title><head>" . "<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>" . "<link rel=\"stylesheet\" href=\"" . $gl_root_path . "themes/default/main.css\" type=\"text/css\"></head><body><br><br>" .
"<table width=\"600\" align=\"center\" class=\"with_border_alternate ErrorMsg\" cellpadding=\"2\"><tr>". "<table width=\"600\" align=\"center\" class=\"with_border_alternate ErrorMsg\" cellpadding=\"2\"><tr>".
@ -1044,7 +1045,20 @@ function DieWithErrorMsg( $szerrmsg )
"<tr><td class=\"cellmenu1_naked\" align=\"left\">Errordetails:</td>" . "<tr><td class=\"cellmenu1_naked\" align=\"left\">Errordetails:</td>" .
"<td class=\"tableBackground\" align=\"left\"><br>" . "<td class=\"tableBackground\" align=\"left\"><br>" .
$szerrmsg . $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>" "</body></html>"
); );
} }

View File

@ -211,13 +211,14 @@ function DB_ReturnSimpleErrorMsg()
function DB_PrintError($MyErrorMsg, $DieOrNot) 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(); $errdesc = mysql_error();
$errno = mysql_errno(); $errno = mysql_errno();
// Define global variable so we know an error has occured! // Define global variable so we know an error has occured!
define('PHPLOGCON_INERROR', true); if ( !defined('PHPLOGCON_INERROR') )
define('PHPLOGCON_INERROR', true);
$errormsg="Database error: $MyErrorMsg $linesep"; $errormsg="Database error: $MyErrorMsg $linesep";
$errormsg.="mysql error: $errdesc $linesep"; $errormsg.="mysql error: $errdesc $linesep";
@ -229,7 +230,20 @@ function DB_PrintError($MyErrorMsg, $DieOrNot)
if ($DieOrNot == true) if ($DieOrNot == true)
DieWithErrorMsg( "$linesep" . $errormsg ); DieWithErrorMsg( "$linesep" . $errormsg );
else else
{
OutputDebugMessage("DB_PrintError: $errormsg", DEBUG_ERROR); 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) function DB_RemoveParserSpecialBadChars($myString)