1
0
mirror of https://github.com/Sonarr/Sonarr.git synced 2024-10-30 07:22:35 +01:00

Fixed error detection for SAB

This commit is contained in:
Mark McDowall 2013-11-20 22:29:26 -08:00
parent bc0bd647df
commit 8bd15612f4
3 changed files with 17 additions and 6 deletions

View File

@ -97,19 +97,19 @@ namespace NzbDrone.Core.Download.Clients.Sabnzbd
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);
}

View File

@ -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);
}
}
}
}

View File

@ -243,7 +243,7 @@ namespace NzbDrone.Core.Download.Clients.Sabnzbd
{
var result = Json.Deserialize<SabJsonError>(response);
if (result.Status)
if (result.Failed)
throw new ApplicationException(result.Error);
}
}