如何在 C# 中捕获 Nemiro.OAuth class 库的异常
How to catch exception for Nemiro.OAuth class library in C#
我正在使用 Nemiro.OAuth class 库在 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。
我正在使用 Nemiro.OAuth class 库在 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。