improved catching of transport exceptions
This commit is contained in:
parent
0680b75cc5
commit
d6069f9231
@ -2,7 +2,6 @@
|
|||||||
|
|
||||||
namespace ManiaControl;
|
namespace ManiaControl;
|
||||||
|
|
||||||
use ManiaControl\Callbacks\Callbacks;
|
|
||||||
use ManiaControl\Plugins\PluginManager;
|
use ManiaControl\Plugins\PluginManager;
|
||||||
use ManiaControl\Update\UpdateManager;
|
use ManiaControl\Update\UpdateManager;
|
||||||
use ManiaControl\Utils\Formatter;
|
use ManiaControl\Utils\Formatter;
|
||||||
@ -140,7 +139,7 @@ class ErrorHandler {
|
|||||||
|
|
||||||
if ($this->maniaControl->getSettingManager() && $this->maniaControl->getUpdateManager()) {
|
if ($this->maniaControl->getSettingManager() && $this->maniaControl->getUpdateManager()) {
|
||||||
$report['UpdateChannel'] = $this->maniaControl->getSettingManager()->getSettingValue($this->maniaControl->getUpdateManager(), UpdateManager::SETTING_UPDATECHECK_CHANNEL);
|
$report['UpdateChannel'] = $this->maniaControl->getSettingManager()->getSettingValue($this->maniaControl->getUpdateManager(), UpdateManager::SETTING_UPDATECHECK_CHANNEL);
|
||||||
$report['ManiaControlVersion'] = ManiaControl::VERSION . ' ' . $this->maniaControl->getUpdateManager()->getNightlyBuildDate();
|
$report['ManiaControlVersion'] = ManiaControl::VERSION . ' ' . $this->maniaControl->getUpdateManager()->getBuildDate();
|
||||||
} else {
|
} else {
|
||||||
$report['ManiaControlVersion'] = ManiaControl::VERSION;
|
$report['ManiaControlVersion'] = ManiaControl::VERSION;
|
||||||
}
|
}
|
||||||
@ -427,13 +426,13 @@ class ErrorHandler {
|
|||||||
$report['OperatingSystem'] = php_uname();
|
$report['OperatingSystem'] = php_uname();
|
||||||
$report['PHPVersion'] = phpversion();
|
$report['PHPVersion'] = phpversion();
|
||||||
|
|
||||||
if ($this->maniaControl->getServer()) {
|
if ($server = $this->maniaControl->getServer()) {
|
||||||
$report['ServerLogin'] = $this->maniaControl->getServer()->login;
|
$report['ServerLogin'] = $server->login;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($this->maniaControl->getSettingManager() && $this->maniaControl->getUpdateManager()) {
|
if ($settingManager = $this->maniaControl->getSettingManager() && $updateManager = $this->maniaControl->getUpdateManager()) {
|
||||||
$report['UpdateChannel'] = $this->maniaControl->getSettingManager()->getSettingValue($this->maniaControl->getUpdateManager(), UpdateManager::SETTING_UPDATECHECK_CHANNEL);
|
$report['UpdateChannel'] = $settingManager->getSettingValue($updateManager, UpdateManager::SETTING_UPDATECHECK_CHANNEL);
|
||||||
$report['ManiaControlVersion'] = ManiaControl::VERSION . ' #' . $this->maniaControl->getUpdateManager()->getNightlyBuildDate();
|
$report['ManiaControlVersion'] = ManiaControl::VERSION . ' #' . $updateManager->getBuildDate();
|
||||||
} else {
|
} else {
|
||||||
$report['ManiaControlVersion'] = ManiaControl::VERSION;
|
$report['ManiaControlVersion'] = ManiaControl::VERSION;
|
||||||
}
|
}
|
||||||
@ -455,7 +454,10 @@ class ErrorHandler {
|
|||||||
if ($this->shouldRestart()) {
|
if ($this->shouldRestart()) {
|
||||||
$this->maniaControl->restart();
|
$this->maniaControl->restart();
|
||||||
}
|
}
|
||||||
$this->maniaControl->quit('Quitting ManiaControl after Exception.');
|
try {
|
||||||
|
$this->maniaControl->quit('Quitting ManiaControl after Exception.');
|
||||||
|
} catch (TransportException $e) {
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -217,13 +217,19 @@ class ManiaControl implements CallbackListener, CommandListener, TimerListener {
|
|||||||
$this->getCallbackManager()->triggerCallback(Callbacks::ONSHUTDOWN);
|
$this->getCallbackManager()->triggerCallback(Callbacks::ONSHUTDOWN);
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($this->getChat()) {
|
if ($chat = $this->getChat()) {
|
||||||
// Announce quit
|
// Announce quit
|
||||||
$this->getChat()->sendInformation('ManiaControl shutting down.');
|
try {
|
||||||
|
$chat->sendInformation('ManiaControl shutting down.');
|
||||||
|
} catch (TransportException $e) {
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Hide UI
|
// Hide UI
|
||||||
$this->getClient()->sendHideManialinkPage();
|
try {
|
||||||
|
$this->getClient()->sendHideManialinkPage();
|
||||||
|
} catch (TransportException $e) {
|
||||||
|
}
|
||||||
|
|
||||||
// Delete client
|
// Delete client
|
||||||
Connection::delete($this->getClient());
|
Connection::delete($this->getClient());
|
||||||
@ -439,7 +445,10 @@ class ManiaControl implements CallbackListener, CommandListener, TimerListener {
|
|||||||
*/
|
*/
|
||||||
public function restart($message = null) {
|
public function restart($message = null) {
|
||||||
// Announce restart
|
// Announce restart
|
||||||
$this->getChat()->sendInformation('Restarting ManiaControl...');
|
try {
|
||||||
|
$this->getChat()->sendInformation('Restarting ManiaControl...');
|
||||||
|
} catch (TransportException $e) {
|
||||||
|
}
|
||||||
Logger::log('Restarting ManiaControl... ' . $message);
|
Logger::log('Restarting ManiaControl... ' . $message);
|
||||||
|
|
||||||
// Start new instance
|
// Start new instance
|
||||||
|
Loading…
Reference in New Issue
Block a user