- refactored many try-catch clauses

- added todos for validating catching
This commit is contained in:
Steffen Schröder
2014-02-13 14:21:25 +01:00
parent 10dfd6b0cb
commit 4197dc82ff
23 changed files with 213 additions and 293 deletions

View File

@ -11,6 +11,7 @@ use ManiaControl\ManiaControl;
use ManiaControl\Manialinks\IconManager;
use ManiaControl\Manialinks\ManialinkPageAnswerListener;
use ManiaControl\Players\Player;
use Maniaplanet\DedicatedServer\Xmlrpc\Exception;
/**
* Class offering commands to manage maps
@ -106,7 +107,8 @@ class MapCommands implements CommandListener, ManialinkPageAnswerListener, Callb
} else {
try {
$mapIndex = $this->maniaControl->client->getNextMapIndex();
} catch(\Exception $e) {
} catch(Exception $e) {
// TODO: is it even possible that an exception other than connection errors will be thrown? - remove try-catch?
trigger_error("Error while Reading the next Map Index");
$this->maniaControl->chat->sendError("Error while Reading next Map Inde");
return;
@ -190,7 +192,8 @@ class MapCommands implements CommandListener, ManialinkPageAnswerListener, Callb
try {
$this->maniaControl->client->nextMap();
} catch(\Exception $e) {
} 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("Error while Skipping the Map");
return;
}
@ -216,7 +219,8 @@ class MapCommands implements CommandListener, ManialinkPageAnswerListener, Callb
$this->maniaControl->log($message, true);
try {
$this->maniaControl->client->restartMap();
} catch(\Exception $e) {
} catch(Exception $e) {
// TODO: is it even possible that an exception other than connection errors will be thrown? - remove try-catch?
//do nothing
}
}