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

View File

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