From d9b44e230c6a0b898a5b4a67ffc2ccb9854d472c Mon Sep 17 00:00:00 2001 From: Joshua Goins Date: Wed, 26 Jun 2024 16:15:37 -0400 Subject: [PATCH] Remove "Unknown error" from login gate message The network error should only be printed in the case where there's a real error, otherwise it adds nothing but confusion. --- launcher/src/squareenixlogin.cpp | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/launcher/src/squareenixlogin.cpp b/launcher/src/squareenixlogin.cpp index 7a6e0ea..2951de0 100644 --- a/launcher/src/squareenixlogin.cpp +++ b/launcher/src/squareenixlogin.cpp @@ -80,16 +80,22 @@ QCoro::Task SquareEnixLogin::checkGateStatus() co_await reply; const QJsonDocument document = QJsonDocument::fromJson(reply->readAll()); + if (document.isEmpty()) { + Q_EMIT m_launcher.loginError(i18n("An error occured when checking login gate status:\n\n%1", reply->errorString())); + co_return false; + } + const bool isGateOpen = !document.isEmpty() && document.object()["status"_L1].toInt() != 0; if (isGateOpen) { qInfo(ASTRA_LOG) << "Gate is open!"; co_return true; - } else { - qInfo(ASTRA_LOG) << "Gate is closed!"; - Q_EMIT m_launcher.loginError(i18n("The login gate is closed, the game may be under maintenance.\n\n%1", reply->errorString())); - co_return false; } + + qInfo(ASTRA_LOG) << "Gate is closed!"; + Q_EMIT m_launcher.loginError(i18n("The login gate is closed, the game may be under maintenance.")); + + co_return false; } QCoro::Task SquareEnixLogin::checkLoginStatus()