From 5dcc8e865cf7f9c6d0754b1559b0d7a1b0c2af4b Mon Sep 17 00:00:00 2001 From: kremsy Date: Sat, 1 Mar 2014 10:49:07 +0100 Subject: [PATCH] cought fatal exception --- application/core/ManiaControl.php | 32 +++++++++++++++++++------------ 1 file changed, 20 insertions(+), 12 deletions(-) diff --git a/application/core/ManiaControl.php b/application/core/ManiaControl.php index 2aeccf71..22192c70 100644 --- a/application/core/ManiaControl.php +++ b/application/core/ManiaControl.php @@ -225,14 +225,14 @@ class ManiaControl implements CommandListener, TimerListener { // Announce quit $this->chat->sendInformation('ManiaControl shutting down.'); - if($this->client){ - try{ - // Hide manialinks - $this->client->sendHideManialinkPage(); - // Close the client connection - $this->client->delete($this->server->ip, $this->server->port); - } catch(FatalException $e){ - $this->errorHandler->triggerDebugNotice($e->getMessage() ." File: " . $e->getFile() . " Line: " . $e->getLine()); + if ($this->client) { + try { + // Hide manialinks + $this->client->sendHideManialinkPage(); + // Close the client connection + $this->client->delete($this->server->ip, $this->server->port); + } catch(FatalException $e) { + $this->errorHandler->triggerDebugNotice($e->getMessage() . " File: " . $e->getFile() . " Line: " . $e->getLine()); } } @@ -326,8 +326,8 @@ class ManiaControl implements CommandListener, TimerListener { } catch(FatalException $e) { //TODO remove - if($this->errorHandler){ - $this->errorHandler->triggerDebugNotice("Fatal Exception: " . $e->getMessage() . " tracestring " . $e->getTraceAsString()); + if ($this->errorHandler) { + $this->errorHandler->triggerDebugNotice("Fatal Exception: " . $e->getMessage() . " Trace: " . $e->getTraceAsString()); } $this->quit($e->getMessage()); } @@ -394,8 +394,16 @@ class ManiaControl implements CommandListener, TimerListener { $this->client->enableCallbacks(true); // Wait for server to be ready - if (!$this->server->waitForStatus(4)) { - trigger_error("Server couldn't get ready!", E_USER_ERROR); + try { + if (!$this->server->waitForStatus(4)) { + trigger_error("Server couldn't get ready!", E_USER_ERROR); + } + } catch(FatalException $e) { + //TODO remove + if ($this->errorHandler) { + $this->errorHandler->triggerDebugNotice("Fatal Exception: " . $e->getMessage() . " Trace: " . $e->getTraceAsString()); + } + $this->quit($e->getMessage()); } // Connect finished