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