no backtrace for user errors

This commit is contained in:
Steffen Schröder 2014-05-24 18:31:38 +02:00
parent 2d7ac34319
commit 1c78afc63b

View File

@ -207,6 +207,7 @@ class ErrorHandler {
} }
$errorTag = $this->getErrorTag($errorNumber); $errorTag = $this->getErrorTag($errorNumber);
$userError = $this->isUserErrorNumber($errorNumber);
$traceSourceClass = null; $traceSourceClass = null;
$message = $errorTag . ': ' . $errorString; $message = $errorTag . ': ' . $errorString;
@ -217,10 +218,13 @@ class ErrorHandler {
$sourceClass = $traceSourceClass; $sourceClass = $traceSourceClass;
} }
$logMessage = $message . PHP_EOL . 'File&Line: ' . $fileLine . PHP_EOL . 'Trace: ' . $traceString; $logMessage = $message . PHP_EOL . 'File&Line: ' . $fileLine;
if (!$userError) {
$logMessage .= PHP_EOL . 'Trace: ' . $traceString;
}
$this->maniaControl->log($logMessage); $this->maniaControl->log($logMessage);
if (!ManiaControl::DEV_MODE && !$this->isUserErrorNumber($errorNumber) && !$suppressed) { if (!ManiaControl::DEV_MODE && !$userError && !$suppressed) {
$error = array(); $error = array();
$error['Type'] = 'Error'; $error['Type'] = 'Error';
$error['Message'] = $message; $error['Message'] = $message;
@ -293,6 +297,16 @@ class ErrorHandler {
return "[PHP ERROR '{$errorLevel}']"; return "[PHP ERROR '{$errorLevel}']";
} }
/**
* Check if the given Error Number is a User Error
*
* @param int $errorNumber
* @return bool
*/
private function isUserErrorNumber($errorNumber) {
return ($errorNumber & E_USER_ERROR || $errorNumber & E_USER_WARNING || $errorNumber & E_USER_NOTICE || $errorNumber & E_USER_DEPRECATED);
}
/** /**
* Get the Source Class via the Error File * Get the Source Class via the Error File
* *
@ -314,16 +328,6 @@ class ErrorHandler {
return $className; return $className;
} }
/**
* Check if the given Error Number is a User Error
*
* @param int $errorNumber
* @return bool
*/
private function isUserErrorNumber($errorNumber) {
return ($errorNumber & E_USER_ERROR || $errorNumber & E_USER_WARNING || $errorNumber & E_USER_NOTICE || $errorNumber & E_USER_DEPRECATED);
}
/** /**
* Test if ManiaControl should stop its Execution * Test if ManiaControl should stop its Execution
* *