From 7084b0244e0f594981e9aaeaca74d66d27a44c98 Mon Sep 17 00:00:00 2001 From: Mark McDowall Date: Wed, 26 Feb 2014 22:06:24 -0800 Subject: [PATCH] Better error message when error is received from SABnzbd --- .../Download/Clients/DownloadClientException.cs | 15 +++++++++++++++ .../Download/Clients/Sabnzbd/SabnzbdProxy.cs | 3 +-- src/NzbDrone.Core/Jobs/Scheduler.cs | 2 +- 3 files changed, 17 insertions(+), 3 deletions(-) create mode 100644 src/NzbDrone.Core/Download/Clients/DownloadClientException.cs diff --git a/src/NzbDrone.Core/Download/Clients/DownloadClientException.cs b/src/NzbDrone.Core/Download/Clients/DownloadClientException.cs new file mode 100644 index 000000000..2b8a8674a --- /dev/null +++ b/src/NzbDrone.Core/Download/Clients/DownloadClientException.cs @@ -0,0 +1,15 @@ +using NzbDrone.Common.Exceptions; + +namespace NzbDrone.Core.Download.Clients +{ + public class DownloadClientException : NzbDroneException + { + public DownloadClientException(string message, params object[] args) : base(message, args) + { + } + + public DownloadClientException(string message) : base(message) + { + } + } +} diff --git a/src/NzbDrone.Core/Download/Clients/Sabnzbd/SabnzbdProxy.cs b/src/NzbDrone.Core/Download/Clients/Sabnzbd/SabnzbdProxy.cs index 6d43e443e..2a1573ba7 100644 --- a/src/NzbDrone.Core/Download/Clients/Sabnzbd/SabnzbdProxy.cs +++ b/src/NzbDrone.Core/Download/Clients/Sabnzbd/SabnzbdProxy.cs @@ -97,7 +97,6 @@ public SabnzbdQueue GetQueue(int start, int limit, SabnzbdSettings settings) var response = ProcessRequest(request, action, settings); return Json.Deserialize(JObject.Parse(response).SelectToken("queue").ToString()); - } public SabnzbdHistory GetHistory(int start, int limit, SabnzbdSettings settings) @@ -156,7 +155,7 @@ private void CheckForError(IRestResponse response) } if (result.Failed) - throw new ApplicationException(result.Error); + throw new DownloadClientException("Error response received from SABnzbd: {0}", result.Error); } //TODO: Find a better home for this diff --git a/src/NzbDrone.Core/Jobs/Scheduler.cs b/src/NzbDrone.Core/Jobs/Scheduler.cs index 6588d3de8..869b5b10a 100644 --- a/src/NzbDrone.Core/Jobs/Scheduler.cs +++ b/src/NzbDrone.Core/Jobs/Scheduler.cs @@ -47,7 +47,7 @@ private void ExecuteCommands() } catch (Exception e) { - _logger.ErrorException("Error occurred while execution task " + task.TypeName, e); + _logger.ErrorException("Error occurred while executing task " + task.TypeName, e); } } }