improved error handling

This commit is contained in:
Steffen Schröder 2014-06-22 18:37:56 +02:00
parent b86161ecd0
commit 0012cb8ab9
2 changed files with 3 additions and 10 deletions

View File

@ -3,7 +3,6 @@
namespace ManiaControl\Server; namespace ManiaControl\Server;
use ManiaControl\ManiaControl; use ManiaControl\ManiaControl;
use Maniaplanet\DedicatedServer\Xmlrpc\Exception;
/** /**
* Manager for Game Mode Script related Stuff * Manager for Game Mode Script related Stuff
@ -51,14 +50,7 @@ class ScriptManager {
$scriptSettings['S_UseScriptCallbacks'] = (bool)$enable; $scriptSettings['S_UseScriptCallbacks'] = (bool)$enable;
$actionName = ($enable ? 'en' : 'dis'); $actionName = ($enable ? 'en' : 'dis');
try {
$this->maniaControl->client->setModeScriptSettings($scriptSettings); $this->maniaControl->client->setModeScriptSettings($scriptSettings);
} catch (Exception $e) {
// TODO temp added 19.04.2014
$this->maniaControl->errorHandler->handleException($e, false);
trigger_error("Couldn't set Mode Script Settings to {$actionName}able Script Callbacks. " . $e->getMessage());
return false;
}
$this->maniaControl->log("Script Callbacks successfully {$actionName}abled!"); $this->maniaControl->log("Script Callbacks successfully {$actionName}abled!");
return true; return true;
} }
@ -69,7 +61,7 @@ class ScriptManager {
* @return bool * @return bool
*/ */
public function isScriptMode() { public function isScriptMode() {
if ($this->isScriptMode === null) { if (is_null($this->isScriptMode)) {
$gameMode = $this->maniaControl->client->getGameMode(); $gameMode = $this->maniaControl->client->getGameMode();
$this->isScriptMode = ($gameMode === 0); $this->isScriptMode = ($gameMode === 0);
} }

View File

@ -149,6 +149,7 @@ class DynamicPointLimitPlugin implements CallbackListener, CommandListener, Plug
$this->maniaControl->chat->sendInformation($message); $this->maniaControl->chat->sendInformation($message);
$this->lastPointLimit = $pointLimit; $this->lastPointLimit = $pointLimit;
} catch (GameModeException $exception) { } catch (GameModeException $exception) {
$this->maniaControl->chat->sendExceptionToAdmins($exception);
} }
} }
} }