From fa76747baa477995f2846954643aaa7c00859973 Mon Sep 17 00:00:00 2001 From: Kawe Mazidjatari <48657826+Mauler125@users.noreply.github.com> Date: Wed, 25 Oct 2023 23:29:37 +0200 Subject: [PATCH] Show a more detailed error if the EULA request failed --- r5dev/game/client/vscript_client.cpp | 10 +++++++--- r5dev/networksystem/pylon.cpp | 8 +++----- r5dev/networksystem/pylon.h | 2 +- 3 files changed, 11 insertions(+), 9 deletions(-) diff --git a/r5dev/game/client/vscript_client.cpp b/r5dev/game/client/vscript_client.cpp index 531c1ed9..eaeadac0 100644 --- a/r5dev/game/client/vscript_client.cpp +++ b/r5dev/game/client/vscript_client.cpp @@ -293,7 +293,9 @@ namespace VScriptCode SQRESULT GetEULAContents(HSQUIRRELVM v) { MSEulaData_t eulaData; - if (g_pMasterServer->GetEULA(eulaData)) + string eulaRequestMessage; + + if (g_pMasterServer->GetEULA(eulaData, eulaRequestMessage)) { // set EULA version cvar to the newly fetched EULA version eula_version->SetValue(eulaData.version); @@ -302,8 +304,10 @@ namespace VScriptCode } else { - Warning(eDLL_T::UI, "Failed to load EULA Data\n"); - sq_pushstring(v, "Failed to load EULA Data", -1); + string error = Format("Failed to load EULA Data: %s", eulaRequestMessage.c_str()); + + Warning(eDLL_T::UI, "%s\n", error.c_str()); + sq_pushstring(v, error.c_str(), -1); } return SQ_OK; diff --git a/r5dev/networksystem/pylon.cpp b/r5dev/networksystem/pylon.cpp index a92024a9..49f8a0f9 100644 --- a/r5dev/networksystem/pylon.cpp +++ b/r5dev/networksystem/pylon.cpp @@ -386,20 +386,18 @@ static bool IsEULAUpToDate() //----------------------------------------------------------------------------- // Purpose: Gets the EULA from master server. -// Input : &outData - +// Input : &outData - +// &outMessage - // Output : True on success, false on failure. //----------------------------------------------------------------------------- -bool CPylon::GetEULA(MSEulaData_t& outData) const +bool CPylon::GetEULA(MSEulaData_t& outData, string& outMessage) const { rapidjson::Document requestJson; requestJson.SetObject(); rapidjson::Document responseJson; - CURLINFO status; - string outMessage; - if (!SendRequest("/eula", requestJson, responseJson, outMessage, status, "eula fetch error", false)) { return false; diff --git a/r5dev/networksystem/pylon.h b/r5dev/networksystem/pylon.h index 18f19cbe..aad96a3e 100644 --- a/r5dev/networksystem/pylon.h +++ b/r5dev/networksystem/pylon.h @@ -25,7 +25,7 @@ public: bool AuthForConnection(const uint64_t nucleusId, const char* ipAddress, const char* authCode, string& outToken, string& outMessage) const; - bool GetEULA(MSEulaData_t& outData) const; + bool GetEULA(MSEulaData_t& outData, string& outMessage) const; void ExtractError(const rapidjson::Document& resultBody, string& outMessage, CURLINFO status, const char* errorText = nullptr) const; void ExtractError(const string& response, string& outMessage, CURLINFO status, const char* messageText = nullptr) const;