Example #1
0
        private void HandleNoError(WWW www, VKRequest httprequest)
        {
            VKRequest vkargs = httprequest;

            vkargs.response = www.text;
            if (httprequest.CallBackFunction != null)
            {
                httprequest.CallBackFunction(vkargs);
            }
        }
 private void handleNetworkError(VKRequest request)
 {
     if (request.attempt < 5)
     {
         request.attempt++;
         VkApi.VkApiInstance.Call(request);
     }
     else
     {
         request.CallBackFunction(request);
     }
 }
 private void handleNeedToShowMessageToUser(VKRequest r)
 {
     YesNoMessageBox.Add(new YesNoTaskData
     {
         OnYesButton = () =>
         {
             r.fullurl += "&confirm=1";
             VkApi.VkApiInstance.Call(r);
         },
         OnNoButton = () => { r.CallBackFunction(r); },
         Message    = Utilities.ParseConfirmationText(r.response)
     });
 }
Example #4
0
        private void HandleVKError(WWW www, VKRequest httprequest)
        {
            var vkerror = Error.ParseVkError(www.text);

            VKRequest vkargs = httprequest;

            vkargs.response = www.text;
            vkargs.error    = vkerror;

            if (GlobalErrorHandler != null)
            {
                GlobalErrorHandler(vkargs);
            }
            else if (vkargs.CallBackFunction != null)
            {
                vkargs.CallBackFunction(vkargs);
            }
        }
Example #5
0
        private void HandleTokenExpired(VKRequest httprequest)
        {
            Debug.Log("Invalid token. Are you logged in?");
            VKRequest vkargs = httprequest;

            vkargs.response = "";

            vkargs.error = new Error {
                error_code = "401", error_msg = "invalid token"
            };

            if (GlobalErrorHandler != null)
            {
                GlobalErrorHandler(vkargs);
            }
            else if (vkargs.CallBackFunction != null)
            {
                vkargs.CallBackFunction(vkargs);
            }
        }
Example #6
0
        private void HandleWWWError(WWW www, VKRequest httprequest)
        {
            var vkerror = new Error()
            {
                error_code = "404",
                error_msg  = www.error
            };

            VKRequest vkargs = httprequest;

            vkargs.response = www.text;
            vkargs.error    = vkerror;

            if (GlobalErrorHandler != null)
            {
                GlobalErrorHandler(vkargs);
            }
            else if (vkargs.CallBackFunction != null)
            {
                vkargs.CallBackFunction(vkargs);
            }
        }
 public void OnGlobalError(VKRequest request)
 {
     if (request.error.error_code == "17")
     {
         handle_17_Error(request);
     }
     else if (request.error.error_code == "14")
     {
         handleCaptchaError(request);
     }
     else if (request.error.error_code == "24")
     {
         handleNeedToShowMessageToUser(request);
     }
     else if (request.error.error_code == "404")
     {
         handleNetworkError(request);
     }
     else
     {
         request.CallBackFunction(request);
     }
 }