Internal error's while generating charts are now handeled

Those error's are now catched and handeled by loganalyzer.
A propper error message is generated and shown to the user.
This commit is contained in:
Andre Lorbach 2014-10-29 15:09:46 +01:00
parent 7c92fd7d6b
commit 8ba53f9134
2 changed files with 24 additions and 17 deletions

View File

@ -484,10 +484,6 @@ if ( !$content['error_occured'] )
if ( isset($extraErrorDescription) )
$content['error_details'] .= "\n\n" . GetAndReplaceLangStr( $content['LN_SOURCES_ERROR_EXTRAMSG'], $extraErrorDescription);
}
//$fields[SYSLOG_UID]['FieldID']
}
else
{
@ -511,15 +507,7 @@ if ( !$content['error_occured'] )
// ---
// Output error if necessary
if ( $content['error_occured'] )
{
// Create template Parser and output results
$content['TITLE'] .= " :: " . $content['LN_GEN_ERRORDETAILS'];
InitTemplateParser();
$page -> parser($content, "chartgenerator.html");
$page -> output();
// Exit in any case
exit;
}
OutpuCustomErrorMessage();
// ---
/*
@ -540,9 +528,28 @@ if ( $content['error_occured'] )
// ---
*/
// --- Output the image
//$graph->Stroke();
$graph->StrokeCSIM( $content['custombasepath'] . basename(__FILE__), '', 0);
// --- Output the image with HTML Code
// Use Exception handling here to Show error's as well!
try {
$graph->StrokeCSIM( $content['custombasepath'] . basename(__FILE__), '', 0);
}
catch(JpGraphException $e) {
$content['error_occured'] = true;
$content['error_details'] = $e->GetMessage();
OutpuCustomErrorMessage();
}
// ---
function OutpuCustomErrorMessage() {
global $page, $content;
// Create template Parser and output results
$content['TITLE'] .= " :: " . $content['LN_GEN_ERRORDETAILS'];
InitTemplateParser();
$page -> parser($content, "chartgenerator.html");
$page -> output();
// Exit in any case
exit;
}
?>

View File

@ -88,7 +88,7 @@ define('READ_CACHE',true);
// Determine if the error handler should be image based or purely
// text based. Image based makes it easier since the script will
// always return an image even in case of errors.
define('USE_IMAGE_ERROR_HANDLER',true);
define('USE_IMAGE_ERROR_HANDLER',false);
// Should the library examine the global php_errmsg string and convert
// any error in it to a graphical representation. This is handy for the