Skip to content

Commit

Permalink
fix: 修复检查更新功能中CA1031的警告
Browse files Browse the repository at this point in the history
  • Loading branch information
leven99 committed Oct 6, 2019
1 parent b53e6e9 commit 98563db
Showing 1 changed file with 16 additions and 9 deletions.
25 changes: 16 additions & 9 deletions ViewModels/MainWindowVM.cs
Original file line number Diff line number Diff line change
Expand Up @@ -407,22 +407,21 @@ public async void UpdateAsync()
}
}
}
catch(TaskCanceledException)
catch(HttpRequestException)
{
DepictInfo = string.Format(cultureInfo, "服务器请求异常,更换服务器......请稍后");
DepictInfo = string.Format(cultureInfo, "GitHub服务器请求异常,更换服务器......请稍后");

await UpdatesAsync().ConfigureAwait(false);
}
catch(HttpRequestException e)
catch (TaskCanceledException)
{
DepictInfo = string.Format(cultureInfo, "[{0}]网络异常,更换服务器......请稍后", e.HResult.ToString("X", cultureInfo));
DepictInfo = string.Format(cultureInfo, "GitHub服务器响应异常,更换服务器......请稍后");

await UpdatesAsync().ConfigureAwait(false);
}
catch (NullReferenceException e)
catch (NullReferenceException)
{
DepictInfo = string.Format(cultureInfo, "[{0}]数据解析异常,请通过帮助菜单报告错误!",
e.HResult.ToString("X", cultureInfo));
DepictInfo = string.Format(cultureInfo, "数据解析异常,请通过帮助菜单报告问题!");
}
}

Expand Down Expand Up @@ -450,9 +449,17 @@ public async Task UpdatesAsync()
}
}
}
catch
catch (HttpRequestException)
{
DepictInfo = string.Format(cultureInfo, "服务器请求异常,请检查网络或稍后再试!");
}
catch (TaskCanceledException)
{
DepictInfo = string.Format(cultureInfo, "服务器响应异常,请检查网络或稍后再试!");
}
catch (NullReferenceException)
{
DepictInfo = string.Format(cultureInfo, "检查更新异常,请检查网络或稍后再试");
DepictInfo = string.Format(cultureInfo, "数据解析异常,请通过帮助菜单报告问题");
}
}

Expand Down

0 comments on commit 98563db

Please sign in to comment.