removed \Exception catches

This commit is contained in:
Steffen Schröder 2014-02-19 17:16:24 +01:00
parent 74124686b5
commit be5ca8e4ad
3 changed files with 18 additions and 21 deletions

View File

@ -169,8 +169,11 @@ class ManialinkManager implements ManialinkPageAnswerListener, CallbackListener
public function enableAltMenu(Player $player) {
try {
$success = $this->maniaControl->client->triggerModeScriptEvent('LibXmlRpc_EnableAltMenu', $player->login);
} catch(\Exception $e) {
return false;
} catch(Exception $e) {
if ($e->getMessage() == 'Not in script mode.') {
return false;
}
throw $e;
}
return $success;
}
@ -184,8 +187,11 @@ class ManialinkManager implements ManialinkPageAnswerListener, CallbackListener
public function disableAltMenu(Player $player) {
try {
$success = $this->maniaControl->client->triggerModeScriptEvent('LibXmlRpc_DisableAltMenu', $player->login);
} catch(\Exception $e) {
return false;
} catch(Exception $e) {
if ($e->getMessage() == 'Not in script mode.') {
return false;
}
throw $e;
}
return $success;
}

View File

@ -330,16 +330,11 @@ class MapManager implements CallbackListener {
$mapsDirectory = $this->maniaControl->server->getMapsDirectory();
if (is_readable($mapsDirectory . $map->fileName)) {
$mapFetcher = new \GBXChallMapFetcher(true);
try {
$mapFetcher->processFile($mapsDirectory . $map->fileName);
$map->authorNick = FORMATTER::stripDirtyCodes($mapFetcher->authorNick);
$map->authorEInfo = $mapFetcher->authorEInfo;
$map->authorZone = $mapFetcher->authorZone;
$map->comment = $mapFetcher->comment;
} catch(\Exception $e) {
// TODO: replace \Exception with api exception class (?)
trigger_error($e->getMessage());
}
}
return $map;
}
@ -577,8 +572,6 @@ class MapManager implements CallbackListener {
* @param $mapDir
* @param $login
* @param $update
* @throws \Exception
* @throws \Maniaplanet\DedicatedServer\Xmlrpc\Exception
*/
private function processMapFile($file, MXMapInfo $mapInfo, $mapDir, $login, $update) {
//Check if map is already on the server
@ -635,14 +628,7 @@ class MapManager implements CallbackListener {
}
// Add map to map list
try {
$this->maniaControl->client->insertMap($mapFileName);
} catch(Exception $e) {
// TODO: is it even possible that an exception other than connection errors will be thrown? - remove try-catch?
$this->maniaControl->chat->sendError("Couldn't add map to match settings!", $login);
return;
}
$this->maniaControl->client->insertMap($mapFileName);
$this->updateFullMapList();
//Update Mx MapInfo

View File

@ -10,6 +10,7 @@ namespace ManiaControl\Server;
use ManiaControl\Callbacks\CallbackListener;
use ManiaControl\Callbacks\CallbackManager;
use ManiaControl\ManiaControl;
use Maniaplanet\DedicatedServer\Xmlrpc\Exception;
class RankingManager implements CallbackListener {
/**
@ -45,8 +46,12 @@ class RankingManager implements CallbackListener {
public function onInit() {
try {
$this->maniaControl->client->triggerModeScriptEvent('LibXmlRpc_GetRankings', '');
} catch(\Exception $e) {
//do nothing
} catch(Exception $e) {
if ($e->getMessage() == 'Not in script mode.') {
// do nothing
return;
}
throw $e;
}
}