improved error handler method names

This commit is contained in:
Steffen Schröder 2014-05-03 22:21:57 +02:00
parent 4f1d560d0b
commit 334892c287
2 changed files with 11 additions and 16 deletions

View File

@ -30,8 +30,8 @@ class ErrorHandler {
*/
public function __construct(ManiaControl $maniaControl) {
$this->maniaControl = $maniaControl;
set_error_handler(array(&$this, 'errorHandler'), -1);
set_exception_handler(array(&$this, 'exceptionHandler'));
set_error_handler(array(&$this, 'handleError'), -1);
set_exception_handler(array(&$this, 'handleException'));
}
/**
@ -47,7 +47,7 @@ class ErrorHandler {
* @param \Exception $ex
* @param bool $shutdown
*/
public function exceptionHandler(\Exception $ex, $shutdown = true) {
public function handleException(\Exception $ex, $shutdown = true) {
// Log exception
$message = "[ManiaControl EXCEPTION]: {$ex->getMessage()}";
$traceMessage = 'Class: ' . get_class($ex) . PHP_EOL;
@ -116,24 +116,19 @@ class ErrorHandler {
* @param $message
*/
public function triggerDebugNotice($message) {
$this->errorHandler(self::MC_DEBUG_NOTICE, $message);
$this->handleError(self::MC_DEBUG_NOTICE, $message);
}
/**
* Error Handler
*
* @param $errorNumber
* @param $errorString
* @param $errorFile
* @param $errorLine
* @param int $errorNumber
* @param string $errorString
* @param string $errorFile
* @param int $errorLine
* @return bool
*/
public function errorHandler($errorNumber, $errorString, $errorFile = null, $errorLine = -1) {
if (error_reporting() === 0) {
// Error suppressed
return false;
}
public function handleError($errorNumber, $errorString, $errorFile = null, $errorLine = -1) {
$userError = $this->isUserErrorNumber($errorNumber);
// Log error

View File

@ -305,7 +305,7 @@ class ManiaControl implements CommandListener, TimerListener {
// Check and Trigger Fatal Errors
$error = error_get_last();
if ($error && ($error['type'] & E_FATAL)) {
$this->errorHandler->errorHandler($error['type'], $error['message'], $error['file'], $error['line']);
$this->errorHandler->handleError($error['type'], $error['message'], $error['file'], $error['line']);
}
// Disable Garbage Collector
@ -376,7 +376,7 @@ class ManiaControl implements CommandListener, TimerListener {
$this->log("Connection interrupted!");
// TODO remove
if ($this->errorHandler) {
$this->errorHandler->exceptionHandler($e, false);
$this->errorHandler->handleException($e, false);
}
$this->quit($e->getMessage());
}