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

@@ -13,12 +13,10 @@
<Platforms>AnyCPU</Platforms>
</PropertyGroup>
<PropertyGroup Condition="$(Configuration) == 'Release'">
<DocumentationFile>$(SolutionDir)\bin\$(Platform)\$(Configuration)\Torch.API.xml</DocumentationFile>
<NoWarn>1591</NoWarn>
</PropertyGroup>
<!-- <Import Project="$(SolutionDir)\TransformOnBuild.targets" /> -->
<ItemGroup>
<PackageReference Include="Newtonsoft.Json" Version="13.0.1" />
<PackageReference Include="NLog" Version="4.7.13" />
<PackageReference Include="SemanticVersioning" Version="2.0.0" />
</ItemGroup>

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)