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) {
|
public function enableAltMenu(Player $player) {
|
||||||
try {
|
try {
|
||||||
$success = $this->maniaControl->client->triggerModeScriptEvent('LibXmlRpc_EnableAltMenu', $player->login);
|
$success = $this->maniaControl->client->triggerModeScriptEvent('LibXmlRpc_EnableAltMenu', $player->login);
|
||||||
} catch(\Exception $e) {
|
} catch(Exception $e) {
|
||||||
|
if ($e->getMessage() == 'Not in script mode.') {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
throw $e;
|
||||||
|
}
|
||||||
return $success;
|
return $success;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -184,9 +187,12 @@ class ManialinkManager implements ManialinkPageAnswerListener, CallbackListener
|
|||||||
public function disableAltMenu(Player $player) {
|
public function disableAltMenu(Player $player) {
|
||||||
try {
|
try {
|
||||||
$success = $this->maniaControl->client->triggerModeScriptEvent('LibXmlRpc_DisableAltMenu', $player->login);
|
$success = $this->maniaControl->client->triggerModeScriptEvent('LibXmlRpc_DisableAltMenu', $player->login);
|
||||||
} catch(\Exception $e) {
|
} catch(Exception $e) {
|
||||||
|
if ($e->getMessage() == 'Not in script mode.') {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
throw $e;
|
||||||
|
}
|
||||||
return $success;
|
return $success;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -330,16 +330,11 @@ class MapManager implements CallbackListener {
|
|||||||
$mapsDirectory = $this->maniaControl->server->getMapsDirectory();
|
$mapsDirectory = $this->maniaControl->server->getMapsDirectory();
|
||||||
if (is_readable($mapsDirectory . $map->fileName)) {
|
if (is_readable($mapsDirectory . $map->fileName)) {
|
||||||
$mapFetcher = new \GBXChallMapFetcher(true);
|
$mapFetcher = new \GBXChallMapFetcher(true);
|
||||||
try {
|
|
||||||
$mapFetcher->processFile($mapsDirectory . $map->fileName);
|
$mapFetcher->processFile($mapsDirectory . $map->fileName);
|
||||||
$map->authorNick = FORMATTER::stripDirtyCodes($mapFetcher->authorNick);
|
$map->authorNick = FORMATTER::stripDirtyCodes($mapFetcher->authorNick);
|
||||||
$map->authorEInfo = $mapFetcher->authorEInfo;
|
$map->authorEInfo = $mapFetcher->authorEInfo;
|
||||||
$map->authorZone = $mapFetcher->authorZone;
|
$map->authorZone = $mapFetcher->authorZone;
|
||||||
$map->comment = $mapFetcher->comment;
|
$map->comment = $mapFetcher->comment;
|
||||||
} catch(\Exception $e) {
|
|
||||||
// TODO: replace \Exception with api exception class (?)
|
|
||||||
trigger_error($e->getMessage());
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
return $map;
|
return $map;
|
||||||
}
|
}
|
||||||
@ -577,8 +572,6 @@ class MapManager implements CallbackListener {
|
|||||||
* @param $mapDir
|
* @param $mapDir
|
||||||
* @param $login
|
* @param $login
|
||||||
* @param $update
|
* @param $update
|
||||||
* @throws \Exception
|
|
||||||
* @throws \Maniaplanet\DedicatedServer\Xmlrpc\Exception
|
|
||||||
*/
|
*/
|
||||||
private function processMapFile($file, MXMapInfo $mapInfo, $mapDir, $login, $update) {
|
private function processMapFile($file, MXMapInfo $mapInfo, $mapDir, $login, $update) {
|
||||||
//Check if map is already on the server
|
//Check if map is already on the server
|
||||||
@ -635,14 +628,7 @@ class MapManager implements CallbackListener {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Add map to map list
|
// Add map to map list
|
||||||
try {
|
|
||||||
$this->maniaControl->client->insertMap($mapFileName);
|
$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();
|
$this->updateFullMapList();
|
||||||
|
|
||||||
//Update Mx MapInfo
|
//Update Mx MapInfo
|
||||||
|
@ -10,6 +10,7 @@ namespace ManiaControl\Server;
|
|||||||
use ManiaControl\Callbacks\CallbackListener;
|
use ManiaControl\Callbacks\CallbackListener;
|
||||||
use ManiaControl\Callbacks\CallbackManager;
|
use ManiaControl\Callbacks\CallbackManager;
|
||||||
use ManiaControl\ManiaControl;
|
use ManiaControl\ManiaControl;
|
||||||
|
use Maniaplanet\DedicatedServer\Xmlrpc\Exception;
|
||||||
|
|
||||||
class RankingManager implements CallbackListener {
|
class RankingManager implements CallbackListener {
|
||||||
/**
|
/**
|
||||||
@ -45,8 +46,12 @@ class RankingManager implements CallbackListener {
|
|||||||
public function onInit() {
|
public function onInit() {
|
||||||
try {
|
try {
|
||||||
$this->maniaControl->client->triggerModeScriptEvent('LibXmlRpc_GetRankings', '');
|
$this->maniaControl->client->triggerModeScriptEvent('LibXmlRpc_GetRankings', '');
|
||||||
} catch(\Exception $e) {
|
} catch(Exception $e) {
|
||||||
|
if ($e->getMessage() == 'Not in script mode.') {
|
||||||
// do nothing
|
// do nothing
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
throw $e;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user