improved exception catching
This commit is contained in:
		| @@ -15,6 +15,7 @@ use Maniaplanet\DedicatedServer\Xmlrpc\AlreadyInListException; | |||||||
| use Maniaplanet\DedicatedServer\Xmlrpc\FaultException; | use Maniaplanet\DedicatedServer\Xmlrpc\FaultException; | ||||||
| use Maniaplanet\DedicatedServer\Xmlrpc\NotInListException; | use Maniaplanet\DedicatedServer\Xmlrpc\NotInListException; | ||||||
| use Maniaplanet\DedicatedServer\Xmlrpc\PlayerStateException; | use Maniaplanet\DedicatedServer\Xmlrpc\PlayerStateException; | ||||||
|  | use Maniaplanet\DedicatedServer\Xmlrpc\ServerOptionsException; | ||||||
| use Maniaplanet\DedicatedServer\Xmlrpc\UnknownPlayerException; | use Maniaplanet\DedicatedServer\Xmlrpc\UnknownPlayerException; | ||||||
|  |  | ||||||
| /** | /** | ||||||
| @@ -189,8 +190,7 @@ class Actions { | |||||||
|  |  | ||||||
| 		try { | 		try { | ||||||
| 			$this->maniaControl->client->forceSpectator($target->login, $spectatorState); | 			$this->maniaControl->client->forceSpectator($target->login, $spectatorState); | ||||||
| 		} catch (FaultException $exception) { | 		} catch (ServerOptionsException $exception) { | ||||||
| 			// TODO: replace by more specific exception "There are too many spectators" |  | ||||||
| 			$this->maniaControl->chat->sendException($exception, $admin->login); | 			$this->maniaControl->chat->sendException($exception, $admin->login); | ||||||
| 			return; | 			return; | ||||||
| 		} | 		} | ||||||
| @@ -205,6 +205,7 @@ class Actions { | |||||||
| 			try { | 			try { | ||||||
| 				$this->maniaControl->client->spectatorReleasePlayerSlot($target->login); | 				$this->maniaControl->client->spectatorReleasePlayerSlot($target->login); | ||||||
| 			} catch (PlayerStateException $e) { | 			} catch (PlayerStateException $e) { | ||||||
|  | 			} catch (UnknownPlayerException $e) { | ||||||
| 			} | 			} | ||||||
| 		} | 		} | ||||||
| 	} | 	} | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user