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