Skip to content

Commit d7cc9f8

Browse files
Erik BylundMikkel Sørensen
authored andcommitted
Actually set errorData in responses
1 parent e78dbf5 commit d7cc9f8

File tree

1 file changed

+4
-7
lines changed

1 file changed

+4
-7
lines changed

Runtime/Client/LootLockerBaseServerAPI.cs

Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -148,12 +148,8 @@ IEnumerator coroutine()
148148
response.text = webRequest.downloadHandler.text;
149149

150150
LootLockerErrorData errorData = LootLockerJson.DeserializeObject<LootLockerErrorData>(webRequest.downloadHandler.text);
151-
// Check if the error uses the "new" error style (https://docs.lootlocker.com/reference/error-codes)
152-
if (errorData != null && !string.IsNullOrEmpty(errorData.code))
153-
{
154-
response.errorData = errorData;
155-
}
156-
else
151+
// Check if the error uses the "old" error style, not the "new" (https://docs.lootlocker.com/reference/error-codes)
152+
if (errorData == null || string.IsNullOrEmpty(errorData.code))
157153
{
158154
errorData = new LootLockerErrorData();
159155
switch (webRequest.responseCode)
@@ -208,7 +204,8 @@ IEnumerator coroutine()
208204
}
209205
errorData.message += " " + ObfuscateJsonStringForLogging(webRequest.downloadHandler.text);
210206
}
211-
LootLockerLogger.GetForLogLevel(LootLockerLogger.LogLevel.Error)(errorData.message + (!string.IsNullOrEmpty(errorData.doc_url) ? " -- " + errorData.doc_url : ""));
207+
response.errorData = errorData;
208+
LootLockerLogger.GetForLogLevel(LootLockerLogger.LogLevel.Error)(response.errorData.message + (!string.IsNullOrEmpty(response.errorData.doc_url) ? " -- " + response.errorData.doc_url : ""));
212209
OnServerResponse?.Invoke(response);
213210
}
214211
}

0 commit comments

Comments
 (0)