improvement error handler
This commit is contained in:
parent
2fd9ae9d16
commit
06980c949e
@ -1,4 +1,5 @@
|
|||||||
<?php
|
<?php
|
||||||
|
use ManiaControl\ManiaControl;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Error and Exception Manager Class
|
* Error and Exception Manager Class
|
||||||
@ -6,22 +7,30 @@
|
|||||||
* @author steeffeen & kremsy
|
* @author steeffeen & kremsy
|
||||||
*/
|
*/
|
||||||
class ErrorHandler {
|
class ErrorHandler {
|
||||||
|
/**
|
||||||
|
* Private Properties
|
||||||
|
*/
|
||||||
|
private $maniaControl = null;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Construct Error Handler
|
* Construct Error Handler
|
||||||
*/
|
*/
|
||||||
public function __construct() {
|
public function __construct(ManiaControl $maniaControl) {
|
||||||
|
$this->maniaControl = $maniaControl;
|
||||||
set_error_handler(array(&$this, 'errorHandler'), -1);
|
set_error_handler(array(&$this, 'errorHandler'), -1);
|
||||||
set_exception_handler(array(&$this, 'exceptionHandler'));
|
set_exception_handler(array(&$this, 'exceptionHandler'));
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* ManiaControl ExceptionHandler
|
* ManiaControl ExceptionHandler
|
||||||
|
* ManiaControl Shuts down after exception
|
||||||
*
|
*
|
||||||
* @param Exception $ex
|
* @param Exception $ex
|
||||||
*/
|
*/
|
||||||
public function exceptionHandler(Exception $ex) {
|
public function exceptionHandler(\Exception $ex) {
|
||||||
$message = "[ManiaControl EXCEPTION]: {$ex->getMessage()} Trace: {$ex->getTraceAsString()}!";
|
$message = "[ManiaControl EXCEPTION]: {$ex->getMessage()} Trace: {$ex->getTraceAsString()}!";
|
||||||
logMessage($message);
|
logMessage($message);
|
||||||
|
exit();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
Loading…
Reference in New Issue
Block a user