private void OnFetchFail(WebCall webCall) { if (webCall.StatusCode == 408) { // Timeout, try again PopupManager.DisplayPopup(TextManager.Get(mTimeoutBody), TextManager.Get(mTimeoutButton), DataManager.FetchInitialData); } else { // Other error string errorBody = TextManager.Get(mErrorBody) + " " + webCall.StatusCode + ": " + webCall.Error; PopupManager.DisplayPopup(errorBody, TextManager.Get(mErrorButton), DataManager.FetchInitialData); } }
private void HandleResult() { IsSuccess = string.IsNullOrEmpty(mWWW.error); if (!IsSuccess) { Error = mWWW.error; if (!mIsQueued) { PopupManager.DisplayPopup("Web Error " + StatusCode + "\n" + Error, "OK", null); } } StatusCode = GetResponseCode(mWWW); if (Application.isEditor) { string debugOutput = (IsSuccess ? "Success" : "Failed") + ": " + URL + "\n"; if (IsSuccess) { debugOutput += "PostHeaders: " + Json.Serialize(Headers) + "\n" + ResponseData; } else { debugOutput += mWWW.error + "\nPostHeaders: " + Json.Serialize(Headers) + "\nPostData: " + SafePostJSON; } if (!IsSuccess) { Debug.LogWarning("!= StatusCode: " + StatusCode + " - " + debugOutput); } else if (Backend.PrintDebug) { Debug.Log("<= StatusCode: " + StatusCode + " - " + debugOutput); } } // If the token is no longer valid force a sign out if (!IsSuccess && mWWW.error.Contains("Unauthorized")) { Backend.LogOut(); } else if (mOnDone != null) { mOnDone(this); } }