Fix Deluge service crashing when download is not found (#97)
This commit is contained in:
@@ -79,6 +79,8 @@ public sealed class DelugeClient
|
|||||||
}
|
}
|
||||||
|
|
||||||
public async Task<TorrentStatus?> GetTorrentStatus(string hash)
|
public async Task<TorrentStatus?> GetTorrentStatus(string hash)
|
||||||
|
{
|
||||||
|
try
|
||||||
{
|
{
|
||||||
return await SendRequest<TorrentStatus?>(
|
return await SendRequest<TorrentStatus?>(
|
||||||
"web.get_torrent_status",
|
"web.get_torrent_status",
|
||||||
@@ -86,6 +88,17 @@ public sealed class DelugeClient
|
|||||||
Fields
|
Fields
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
catch (DelugeClientException e)
|
||||||
|
{
|
||||||
|
// Deluge returns an error when the torrent is not found
|
||||||
|
if (e.Message == "AttributeError: 'NoneType' object has no attribute 'call'")
|
||||||
|
{
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
throw;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
public async Task<List<TorrentStatus>?> GetStatusForAllTorrents()
|
public async Task<List<TorrentStatus>?> GetStatusForAllTorrents()
|
||||||
{
|
{
|
||||||
|
|||||||
Reference in New Issue
Block a user