improved connection exception reporting

This commit is contained in:
Steffen Schröder 2014-04-28 19:12:40 +02:00
parent 8a068a256d
commit 429702d2e6
2 changed files with 13 additions and 12 deletions

View File

@ -48,7 +48,7 @@ class ErrorHandler {
*
* @param \Exception $ex
*/
public function exceptionHandler(\Exception $ex) {
public function exceptionHandler(\Exception $ex, $shutdown = true) {
// Log exception
$message = "[ManiaControl EXCEPTION]: {$ex->getMessage()}";
$traceMessage = 'Class: ' . get_class($ex) . PHP_EOL;
@ -93,11 +93,13 @@ class ErrorHandler {
}
}
if ($shutdown) {
if ($this->shouldRestart()) {
$this->maniaControl->restart();
}
exit();
}
}
/**
* Error Handler
@ -231,7 +233,6 @@ class ErrorHandler {
/**
* Parse the Debug Backtrace into a String for the Error Report
*
* return string
*/
private function parseBackTrace(array $backtrace) {

View File

@ -353,7 +353,7 @@ class ManiaControl implements CommandListener, TimerListener {
$this->log("Connection interrupted!");
// TODO remove
if ($this->errorHandler) {
$this->errorHandler->triggerDebugNotice("Fatal Exception: " . $e->getMessage() . " Trace: " . $e->getTraceAsString());
$this->errorHandler->exceptionHandler($e, false);
}
$this->quit($e->getMessage());
}