1
0
Fork 0
mirror of https://github.com/Radarr/Radarr synced 2024-12-27 02:09:59 +00:00

Add WebException handlers to prevent them reaching the UI.

This commit is contained in:
Taloth Saldono 2016-03-17 20:53:11 +01:00
parent 2d96914bfa
commit 1154e0eeb3
6 changed files with 37 additions and 3 deletions

View file

@ -229,6 +229,10 @@ private JsonRpcResponse<TResult> ProcessRequest<TResult>(JsonRpcRequestBuilder r
throw new DownloadClientException("Unable to connect to Deluge, please check your settings", ex);
}
}
catch (WebException ex)
{
throw new DownloadClientException("Unable to connect to Deluge, please check your settings", ex);
}
}
private void AuthenticateClient(JsonRpcRequestBuilder requestBuilder, DelugeSettings settings, bool reauthenticate = false)

View file

@ -1,5 +1,6 @@
using System;
using System.Collections.Generic;
using System.Net;
using Newtonsoft.Json;
using NLog;
using NzbDrone.Common.Cache;
@ -158,6 +159,10 @@ private T ProcessRequest<T>(HttpRequestBuilder requestBuilder, bool requiresAuth
{
throw new DownloadClientException("Unable to connect to NZBVortex, please check your settings", ex);
}
catch (WebException ex)
{
throw new DownloadClientException("Unable to connect to NZBVortex, please check your settings", ex);
}
}
private void AuthenticateClient(HttpRequestBuilder requestBuilder, NzbVortexSettings settings, bool reauthenticate = false)

View file

@ -174,6 +174,10 @@ private T ProcessRequest<T>(NzbgetSettings settings, string method, params objec
throw new DownloadClientException("Unable to connect to NzbGet. " + ex.Message, ex);
}
catch (WebException ex)
{
throw new DownloadClientException("Unable to connect to NzbGet. " + ex.Message, ex);
}
_logger.Trace("Response: {0}", response.Content);

View file

@ -5,6 +5,7 @@
using NzbDrone.Common.Serializer;
using NzbDrone.Core.Download.Clients.Sabnzbd.Responses;
using NzbDrone.Common.Http;
using System.Net;
namespace NzbDrone.Core.Download.Clients.Sabnzbd
{
@ -167,6 +168,10 @@ private string ProcessRequest(HttpRequestBuilder requestBuilder, SabnzbdSettings
{
throw new DownloadClientException("Unable to connect to SABnzbd, please check your settings", ex);
}
catch (WebException ex)
{
throw new DownloadClientException("Unable to connect to SABnzbd, please check your settings", ex);
}
_logger.Trace("Response: {0}", response.Content);

View file

@ -160,9 +160,13 @@ private TResult ProcessRequest<TResult>(HttpRequestBuilder requestBuilder, QBitt
}
else
{
throw new DownloadClientException("Failed to connect to download client", ex);
throw new DownloadClientException("Failed to connect to qBitTorrent, check your settings.", ex);
}
}
catch (WebException ex)
{
throw new DownloadClientException("Failed to connect to qBitTorrent, please check your settings.", ex);
}
return Json.Deserialize<TResult>(response.Content);
}
@ -201,7 +205,11 @@ private void AuthenticateClient(HttpRequestBuilder requestBuilder, QBittorrentSe
throw new DownloadClientAuthenticationException("Failed to authenticate with qbitTorrent.", ex);
}
throw;
throw new DownloadClientException("Failed to connect to qBitTorrent, please check your settings.", ex);
}
catch (WebException ex)
{
throw new DownloadClientException("Failed to connect to qBitTorrent, please check your settings.", ex);
}
if (response.Content != "Ok.") // returns "Fails." on bad login

View file

@ -193,6 +193,10 @@ public UTorrentResponse ProcessRequest(HttpRequestBuilder requestBuilder, UTorre
throw new DownloadClientException("Unable to connect to Deluge, please check your settings", ex);
}
}
catch (WebException ex)
{
throw new DownloadClientException("Unable to connect to Deluge, please check your settings", ex);
}
return Json.Deserialize<UTorrentResponse>(response.Content);
}
@ -230,7 +234,11 @@ private void AuthenticateClient(HttpRequestBuilder requestBuilder, UTorrentSetti
throw new DownloadClientAuthenticationException("Failed to authenticate with uTorrent.");
}
throw;
throw new DownloadClientException("Unable to connect to uTorrent, please check your settings", ex);
}
catch (WebException ex)
{
throw new DownloadClientException("Unable to connect to uTorrent, please check your settings", ex);
}
cookies = response.GetCookies();