removed \Exception catches
This commit is contained in:
parent
74124686b5
commit
be5ca8e4ad
@ -169,9 +169,12 @@ class ManialinkManager implements ManialinkPageAnswerListener, CallbackListener
|
||||
public function enableAltMenu(Player $player) {
|
||||
try {
|
||||
$success = $this->maniaControl->client->triggerModeScriptEvent('LibXmlRpc_EnableAltMenu', $player->login);
|
||||
} catch(\Exception $e) {
|
||||
} catch(Exception $e) {
|
||||
if ($e->getMessage() == 'Not in script mode.') {
|
||||
return false;
|
||||
}
|
||||
throw $e;
|
||||
}
|
||||
return $success;
|
||||
}
|
||||
|
||||
@ -184,9 +187,12 @@ class ManialinkManager implements ManialinkPageAnswerListener, CallbackListener
|
||||
public function disableAltMenu(Player $player) {
|
||||
try {
|
||||
$success = $this->maniaControl->client->triggerModeScriptEvent('LibXmlRpc_DisableAltMenu', $player->login);
|
||||
} catch(\Exception $e) {
|
||||
} catch(Exception $e) {
|
||||
if ($e->getMessage() == 'Not in script mode.') {
|
||||
return false;
|
||||
}
|
||||
throw $e;
|
||||
}
|
||||
return $success;
|
||||
}
|
||||
|
||||
|
@ -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->updateFullMapList();
|
||||
|
||||
//Update Mx MapInfo
|
||||
|
@ -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;
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user