mirror of
https://github.com/Radarr/Radarr.git
synced 2024-09-11 12:02:35 +02:00
Fixed error detection for SAB
This commit is contained in:
parent
bc0bd647df
commit
8bd15612f4
@ -97,19 +97,19 @@ private void CheckForError(IRestResponse response)
|
||||
|
||||
if (response.Content.StartsWith("error", StringComparison.InvariantCultureIgnoreCase))
|
||||
{
|
||||
result.Status = false;
|
||||
result.Status = "false";
|
||||
result.Error = response.Content.Replace("error: ", "");
|
||||
}
|
||||
|
||||
else
|
||||
{
|
||||
result.Status = true;
|
||||
result.Status = "true";
|
||||
}
|
||||
|
||||
result.Error = response.Content.Replace("error: ", "");
|
||||
}
|
||||
|
||||
if (!result.Status)
|
||||
if (result.Failed)
|
||||
throw new ApplicationException(result.Error);
|
||||
}
|
||||
|
||||
|
@ -1,8 +1,19 @@
|
||||
namespace NzbDrone.Core.Download.Clients.Sabnzbd
|
||||
using System;
|
||||
|
||||
namespace NzbDrone.Core.Download.Clients.Sabnzbd
|
||||
{
|
||||
public class SabJsonError
|
||||
{
|
||||
public bool Status { get; set; }
|
||||
public string Status { get; set; }
|
||||
public string Error { get; set; }
|
||||
|
||||
public bool Failed
|
||||
{
|
||||
get
|
||||
{
|
||||
return !String.IsNullOrWhiteSpace(Status) &&
|
||||
Status.Equals("false", StringComparison.InvariantCultureIgnoreCase);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -243,7 +243,7 @@ private void CheckForError(string response)
|
||||
{
|
||||
var result = Json.Deserialize<SabJsonError>(response);
|
||||
|
||||
if (result.Status)
|
||||
if (result.Failed)
|
||||
throw new ApplicationException(result.Error);
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user