Commits

HexRx committed 8d20595

Add check for connection problem in DropboxAPI

  • Participants
  • Parent commits 8d16c7b

Comments (0)

Files changed (1)

KPDataSave/Libs/DropboxAPI/DropboxClient.cs

             request.AddUrlSegment("version", version);
 
             RestResponse response = client.Execute(request);
+            // Если нет соединения с инетом
+            if (response.StatusCode == 0)
+                throw new DropboxClientException(response.Content, response.StatusCode);
             if (response.StatusCode != HttpStatusCode.OK)
                 throw new DropboxClientException(JsonConvert.DeserializeObject<APIError>(response.Content).Error, response.StatusCode);
 
             client.Authenticator = OAuth1Authenticator.ForAccessToken(appKey, appSecret, oauth_token, oauth_token_secret);
 
             RestResponse response = client.Execute(request);
+            if (response.StatusCode == 0)
+                throw new DropboxClientException(response.Content, response.StatusCode);
             if (response.StatusCode != HttpStatusCode.OK)
                 throw new DropboxClientException(JsonConvert.DeserializeObject<APIError>(response.Content).Error, response.StatusCode);