replaced debug notices by chat messages

This commit is contained in:
Steffen Schröder 2014-04-14 13:19:05 +02:00
parent 17b7e4249f
commit 04d47fb61f
3 changed files with 17 additions and 45 deletions

View File

@ -132,8 +132,9 @@ class ManialinkManager implements ManialinkPageAnswerListener, CallbackListener
public function sendManialink($manialinkText, $logins = null, $timeout = 0, $hideOnClick = false) { public function sendManialink($manialinkText, $logins = null, $timeout = 0, $hideOnClick = false) {
$manialinkText = (string) $manialinkText; $manialinkText = (string) $manialinkText;
if(!$manialinkText) if(!$manialinkText) {
return true; return true;
}
try { try {
if (!$logins) { if (!$logins) {
@ -159,12 +160,10 @@ class ManialinkManager implements ManialinkPageAnswerListener, CallbackListener
return $success; return $success;
} }
} catch(Exception $e) { } catch(Exception $e) {
if($e->getMessage() == "Login unknown."){ if($e->getMessage() == "Login unknown.") {
return false; return false;
} }
$this->maniaControl->errorHandler->triggerDebugNotice("Exception while sending Manialink: " . $e->getMessage()); throw $e;
// TODO: only possible valid exception should be "wrong login" - throw others (like connection error)
return false;
} }
return true; return true;
@ -217,7 +216,8 @@ class ManialinkManager implements ManialinkPageAnswerListener, CallbackListener
// render and display xml // render and display xml
$this->sendManialink($maniaLink, $player->login); $this->sendManialink($maniaLink, $player->login);
if ($widgetName != '') { //TODO make check by manialinkId, getter is needed to avoid uses on non main widgets if ($widgetName != '') {
//TODO make check by manialinkId, getter is needed to avoid uses on non main widgets
$this->disableAltMenu($player); $this->disableAltMenu($player);
// Trigger callback // Trigger callback
$this->maniaControl->callbackManager->triggerCallback(self::CB_MAIN_WINDOW_OPENED, $player, $widgetName); $this->maniaControl->callbackManager->triggerCallback(self::CB_MAIN_WINDOW_OPENED, $player, $widgetName);

View File

@ -88,14 +88,7 @@ class PlayerActions {
try { try {
$this->maniaControl->client->forceSpectator($target->login, self::SPECTATOR_PLAYER); $this->maniaControl->client->forceSpectator($target->login, self::SPECTATOR_PLAYER);
} catch(Exception $e) { } catch(Exception $e) {
if ($e->getMessage() == 'There are too many players') { $this->maniaControl->chat->sendException($e, $admin->login);
$this->maniaControl->chat->sendError("Too many Spectators");
return;
} else {
// TODO: only possible valid exception should be "wrong login" - throw others (like connection error)
$this->maniaControl->errorHandler->triggerDebugNotice("PlayerActions Debug Line 90: " . $e->getMessage());
$this->maniaControl->chat->sendError('Error occurred: ' . $e->getMessage(), $admin->login);
}
return; return;
} }
@ -103,9 +96,7 @@ class PlayerActions {
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(Exception $e) {
// TODO: only possible valid exception should be "wrong login" - throw others (like connection error) $this->maniaControl->chat->sendException($e, $admin->login);
$this->maniaControl->errorHandler->triggerDebugNotice("PlayerActions Debug Line 100: " . $e->getMessage());
$this->maniaControl->chat->sendError('Error occurred: ' . $e->getMessage(), $admin->login);
return; return;
} }
} }
@ -184,17 +175,12 @@ class PlayerActions {
return; return;
} }
try { try {
$this->maniaControl->client->forceSpectator($target->login, $spectatorState); $this->maniaControl->client->forceSpectator($target->login, $spectatorState);
} catch(Exception $e) { } catch(Exception $e) {
if ($e->getMessage() == "There are too many spectators") { $this->maniaControl->chat->sendException($e, $admin->login);
$this->maniaControl->chat->sendError($e->getMessage(), $adminLogin);
return; return;
} }
throw $e;
}
$title = $this->maniaControl->authenticationManager->getAuthLevelName($admin->authLevel); $title = $this->maniaControl->authenticationManager->getAuthLevelName($admin->authLevel);
$chatMessage = $title . ' $<' . $admin->nickname . '$> forced $<' . $target->nickname . '$> to Spectator!'; $chatMessage = $title . ' $<' . $admin->nickname . '$> forced $<' . $target->nickname . '$> to Spectator!';
@ -206,14 +192,8 @@ class PlayerActions {
try { try {
$this->maniaControl->client->spectatorReleasePlayerSlot($target->login); $this->maniaControl->client->spectatorReleasePlayerSlot($target->login);
} catch(Exception $e) { } catch(Exception $e) {
//if ($e->getMessage() == 'The player is not a spectator') { $this->maniaControl->chat->sendException($e, $admin->login);
//$this->kickPlayer($adminLogin, $targetLogin, 'Disconnect'); return;
//$this->maniaControl->errorHandler->triggerDebugNotice("inaktiv spec player kicked " . $e->getMessage());
//} else {
$this->maniaControl->errorHandler->triggerDebugNotice("PlayerActions Debug Line 183: " . $e->getMessage());
// TODO: only possible valid exception should be "wrong login" - throw others (like connection error)
//do nothing
//}
} }
} }
} }
@ -381,12 +361,7 @@ class PlayerActions {
$this->maniaControl->client->kick($target->login, $message); $this->maniaControl->client->kick($target->login, $message);
} }
} catch(Exception $e) { } catch(Exception $e) {
if ($e == "Login unknown.") { $this->maniaControl->chat->sendException($e, $admin->login);
return;
}
// TODO: only possible valid exception should be "wrong login" - throw others (like connection error)
$this->maniaControl->errorHandler->triggerDebugNotice("PlayerActions Debug Line 354: " . $e->getMessage());
$this->maniaControl->chat->sendError('Error occurred: ' . $e->getMessage(), $admin->login);
return; return;
} }

View File

@ -651,8 +651,7 @@ class PlayerList implements ManialinkPageAnswerListener, CallbackListener, Timer
$this->maniaControl->client->forceSpectator($adminLogin, PlayerActions::SPECTATOR_BUT_KEEP_SELECTABLE); $this->maniaControl->client->forceSpectator($adminLogin, PlayerActions::SPECTATOR_BUT_KEEP_SELECTABLE);
$this->maniaControl->client->forceSpectatorTarget($adminLogin, $targetLogin, 1); $this->maniaControl->client->forceSpectatorTarget($adminLogin, $targetLogin, 1);
} catch(Exception $e) { } catch(Exception $e) {
$this->maniaControl->errorHandler->triggerDebugNotice("PlayerList Debug Line 653: " . $e->getMessage()); $this->maniaControl->chat->sendException($e, $adminLogin);
// TODO: only possible valid exception should be "wrong login" - throw others (like connection error)
} }
break; break;
case self::ACTION_OPEN_PLAYER_DETAILED: case self::ACTION_OPEN_PLAYER_DETAILED:
@ -724,10 +723,8 @@ class PlayerList implements ManialinkPageAnswerListener, CallbackListener, Timer
$this->maniaControl->client->forceSpectator($target->login, PlayerActions::SPECTATOR_BUT_KEEP_SELECTABLE); $this->maniaControl->client->forceSpectator($target->login, PlayerActions::SPECTATOR_BUT_KEEP_SELECTABLE);
$this->maniaControl->client->spectatorReleasePlayerSlot($target->login); $this->maniaControl->client->spectatorReleasePlayerSlot($target->login);
} catch(Exception $e) { } catch(Exception $e) {
if ($e->getMessage() != 'Login unknown.') { if ($e->getMessage() != 'Login unknown.' && $e->getMessage() != 'The player is not a spectator') {
//do nothing $this->maniaControl->chat->sendException($e);
// TODO: only possible valid exception should be "wrong login" - throw others (like connection error)
$this->maniaControl->errorHandler->triggerDebugNotice("PlayerList Debug Line 727: " . $e->getMessage());
} }
} }
}); });