From 9243a699a8831ad10258fe0cef8013caff87c6d9 Mon Sep 17 00:00:00 2001 From: Joshua Goins Date: Fri, 18 Aug 2023 22:03:07 -0400 Subject: [PATCH] Report login gate errors as well --- launcher/src/assetupdater.cpp | 7 ++++--- launcher/src/gameinstaller.cpp | 2 +- launcher/src/squareboot.cpp | 13 ++----------- 3 files changed, 7 insertions(+), 15 deletions(-) diff --git a/launcher/src/assetupdater.cpp b/launcher/src/assetupdater.cpp index b9a6f40..8a559a0 100644 --- a/launcher/src/assetupdater.cpp +++ b/launcher/src/assetupdater.cpp @@ -95,12 +95,13 @@ void AssetUpdater::update() connect(reply, &QNetworkReply::finished, [this, reply] { Q_EMIT launcher.stageChanged("Checking for Dalamud updates..."); - QByteArray str = reply->readAll(); - if (str.isEmpty()) { - Q_EMIT launcher.loginError("Could not check for Dalamud updates."); + if (reply->error() != QNetworkReply::NetworkError::NoError) { + Q_EMIT launcher.loginError(QStringLiteral("Could not check for Dalamud updates.\n\n%1").arg(reply->errorString())); return; } + QByteArray str = reply->readAll(); + // for some god forsaken reason, the version string comes back as raw // bytes, ex: \xFF\xFE{\x00\"\x00""A\x00s\x00s\x00""e\x00m\x00 so we // start at the first character of the json '{' and work our way up. diff --git a/launcher/src/gameinstaller.cpp b/launcher/src/gameinstaller.cpp index fdcbcd3..c676880 100644 --- a/launcher/src/gameinstaller.cpp +++ b/launcher/src/gameinstaller.cpp @@ -30,7 +30,7 @@ void GameInstaller::installGame() auto reply = m_launcher.mgr->get(request); QObject::connect(reply, &QNetworkReply::finished, [this, reply, installDirectory] { if (reply->error() != QNetworkReply::NetworkError::NoError) { - Q_EMIT error(QStringLiteral("An error has occurred when downloading the installer:\n%1").arg(reply->errorString())); + Q_EMIT error(QStringLiteral("An error has occurred when downloading the installer.\n\n%1").arg(reply->errorString())); return; } diff --git a/launcher/src/squareboot.cpp b/launcher/src/squareboot.cpp index 5e6bd28..b2ea743 100644 --- a/launcher/src/squareboot.cpp +++ b/launcher/src/squareboot.cpp @@ -77,23 +77,14 @@ void SquareBoot::checkGateStatus(LoginInformation *info) auto reply = window.mgr->get(request); connect(reply, &QNetworkReply::finished, [this, reply, info] { - // I happen to run into this issue often, if I start the launcher really quickly after bootup - // it's possible to actually check this quicker than the network is actually available, - // causing the launcher to be stuck in "maintenace mode". so if that happens, we try to rerun this logic. - // TODO: this selection of errors is currently guesswork, i'm assuming one of these will fit the bill of - // "internet is unavailable" in some way. - if (reply->error() == QNetworkReply::HostNotFoundError || reply->error() == QNetworkReply::TimeoutError - || reply->error() == QNetworkReply::UnknownServerError) - checkGateStatus(info); - - QJsonDocument document = QJsonDocument::fromJson(reply->readAll()); + const QJsonDocument document = QJsonDocument::fromJson(reply->readAll()); const bool isGateOpen = !document.isEmpty() && document.object()["status"].toInt() != 0; if (isGateOpen) { bootCheck(*info); } else { - Q_EMIT window.loginError(i18n("The login gate is closed, the game may be under maintenance.")); + Q_EMIT window.loginError(i18n("The login gate is closed, the game may be under maintenance.\n\n%1", reply->errorString())); } }); }