improved error handling
This commit is contained in:
parent
9ae9c1cf07
commit
e25b352a7a
@ -12,9 +12,7 @@ use ManiaControl\ManiaControl;
|
|||||||
use ManiaControl\Manialinks\ManialinkManager;
|
use ManiaControl\Manialinks\ManialinkManager;
|
||||||
use ManiaControl\Utils\Formatter;
|
use ManiaControl\Utils\Formatter;
|
||||||
use Maniaplanet\DedicatedServer\Xmlrpc\AlreadyInListException;
|
use Maniaplanet\DedicatedServer\Xmlrpc\AlreadyInListException;
|
||||||
use Maniaplanet\DedicatedServer\Xmlrpc\Exception;
|
|
||||||
use Maniaplanet\DedicatedServer\Xmlrpc\FaultException;
|
use Maniaplanet\DedicatedServer\Xmlrpc\FaultException;
|
||||||
use Maniaplanet\DedicatedServer\Xmlrpc\GameModeException;
|
|
||||||
use Maniaplanet\DedicatedServer\Xmlrpc\NotInListException;
|
use Maniaplanet\DedicatedServer\Xmlrpc\NotInListException;
|
||||||
use Maniaplanet\DedicatedServer\Xmlrpc\PlayerStateException;
|
use Maniaplanet\DedicatedServer\Xmlrpc\PlayerStateException;
|
||||||
use Maniaplanet\DedicatedServer\Xmlrpc\UnknownPlayerException;
|
use Maniaplanet\DedicatedServer\Xmlrpc\UnknownPlayerException;
|
||||||
@ -89,13 +87,20 @@ class PlayerActions {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($target->isSpectator && !$this->forcePlayerToPlay($adminLogin, $targetLogin, true, false)) {
|
if ($target->isSpectator) {
|
||||||
|
try {
|
||||||
|
if (!$this->forcePlayerToPlay($adminLogin, $targetLogin, true, false)) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
} catch (FaultException $exception) {
|
||||||
|
$this->maniaControl->chat->sendException($exception, $admin);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
try {
|
try {
|
||||||
$this->maniaControl->client->forcePlayerTeam($target->login, $teamId);
|
$this->maniaControl->client->forcePlayerTeam($target->login, $teamId);
|
||||||
} catch (GameModeException $e) {
|
} catch (FaultException $exception) {
|
||||||
|
// TODO: replace by more specific exception "there are too many ..."
|
||||||
$this->forcePlayerToPlay($adminLogin, $targetLogin);
|
$this->forcePlayerToPlay($adminLogin, $targetLogin);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@ -136,17 +141,18 @@ class PlayerActions {
|
|||||||
|
|
||||||
try {
|
try {
|
||||||
$this->maniaControl->client->forceSpectator($target->login, self::SPECTATOR_PLAYER);
|
$this->maniaControl->client->forceSpectator($target->login, self::SPECTATOR_PLAYER);
|
||||||
} catch (FaultException $e) {
|
} catch (FaultException $exception) {
|
||||||
//TODO exception 'There are too many players' appeared 28.04.2014, wait for more before add to fault exception
|
// TODO: replace by more specific exception "there are too many ..."
|
||||||
$this->maniaControl->chat->sendException($e, $admin);
|
$this->maniaControl->chat->sendException($exception, $admin);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($userIsAbleToSelect) {
|
if ($userIsAbleToSelect) {
|
||||||
try {
|
try {
|
||||||
$this->maniaControl->client->forceSpectator($target->login, self::SPECTATOR_USER_SELECTABLE);
|
$this->maniaControl->client->forceSpectator($target->login, self::SPECTATOR_USER_SELECTABLE);
|
||||||
} catch (Exception $e) {
|
} catch (FaultException $exception) {
|
||||||
$this->maniaControl->chat->sendException($e, $admin);
|
// TODO: replace by more specific exception "there are too many ..."
|
||||||
|
$this->maniaControl->chat->sendException($exception, $admin);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -183,8 +189,9 @@ class PlayerActions {
|
|||||||
|
|
||||||
try {
|
try {
|
||||||
$this->maniaControl->client->forceSpectator($target->login, $spectatorState);
|
$this->maniaControl->client->forceSpectator($target->login, $spectatorState);
|
||||||
} catch (Exception $e) {
|
} catch (FaultException $exception) {
|
||||||
$this->maniaControl->chat->sendException($e, $admin->login);
|
// TODO: replace by more specific exception "There are too many spectators"
|
||||||
|
$this->maniaControl->chat->sendException($exception, $admin->login);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user