exception fixes

This commit is contained in:
zznty
2022-01-30 19:23:43 +07:00
parent 8efe8ae398
commit 057d126658
8 changed files with 38 additions and 16 deletions

View File

@@ -38,8 +38,10 @@ namespace Torch.API.WebAPI
public async Task<PluginItem> QueryOne(string guid)
{
return (PluginItem) await _client.GetFromJsonAsync(string.Format(PLUGIN_QUERY, guid), typeof(PluginItem),
CancellationToken.None);
using var res = await _client.GetAsync(string.Format(PLUGIN_QUERY, guid));
if (!res.IsSuccessStatusCode)
return null;
return await res.Content.ReadFromJsonAsync<PluginItem>();
}
public Task<bool> DownloadPlugin(Guid guid, string path = null)