如何在 C# 中捕获 Nemiro.OAuth 类库的异常



我正在使用Nemiro.OAuth类库在C#中集成Dropbox API。假设当我进行 API 调用时出现错误,例如 -

 try
                {
                    RequestResult strReq = OAuthUtility.Post
                    (
                        "https://api.dropboxapi.com/1/fileops/move",
                        new HttpParameterCollection
                        {
                            {"access_token", "AccessToken"},  
                            {"root", "auto"},
                            {"from_path", Path.Combine("Path", Name)},
                            {"to_path", (Path.Combine("Path", MovePath) + Name)}
                        }
                    );
               if (strReq.StatusCode == 200)
               {
               }
              else
              {
              }
        }
       catch ()
       {}

如何跟踪此请求的确切错误?如果有人有任何想法,请分享。

应该使用 RequestException。

最新更新