mirror of
https://github.com/Sonarr/Sonarr.git
synced 2024-12-16 11:37:58 +02:00
Add WebException handlers to prevent them reaching the UI.
This commit is contained in:
parent
2d96914bfa
commit
1154e0eeb3
@ -229,6 +229,10 @@ private JsonRpcResponse<TResult> ProcessRequest<TResult>(JsonRpcRequestBuilder r
|
|||||||
throw new DownloadClientException("Unable to connect to Deluge, please check your settings", ex);
|
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)
|
private void AuthenticateClient(JsonRpcRequestBuilder requestBuilder, DelugeSettings settings, bool reauthenticate = false)
|
||||||
|
@ -1,5 +1,6 @@
|
|||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
|
using System.Net;
|
||||||
using Newtonsoft.Json;
|
using Newtonsoft.Json;
|
||||||
using NLog;
|
using NLog;
|
||||||
using NzbDrone.Common.Cache;
|
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);
|
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)
|
private void AuthenticateClient(HttpRequestBuilder requestBuilder, NzbVortexSettings settings, bool reauthenticate = false)
|
||||||
|
@ -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);
|
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);
|
_logger.Trace("Response: {0}", response.Content);
|
||||||
|
|
||||||
|
@ -5,6 +5,7 @@
|
|||||||
using NzbDrone.Common.Serializer;
|
using NzbDrone.Common.Serializer;
|
||||||
using NzbDrone.Core.Download.Clients.Sabnzbd.Responses;
|
using NzbDrone.Core.Download.Clients.Sabnzbd.Responses;
|
||||||
using NzbDrone.Common.Http;
|
using NzbDrone.Common.Http;
|
||||||
|
using System.Net;
|
||||||
|
|
||||||
namespace NzbDrone.Core.Download.Clients.Sabnzbd
|
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);
|
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);
|
_logger.Trace("Response: {0}", response.Content);
|
||||||
|
|
||||||
|
@ -160,9 +160,13 @@ private TResult ProcessRequest<TResult>(HttpRequestBuilder requestBuilder, QBitt
|
|||||||
}
|
}
|
||||||
else
|
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);
|
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 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
|
if (response.Content != "Ok.") // returns "Fails." on bad login
|
||||||
|
@ -193,6 +193,10 @@ public UTorrentResponse ProcessRequest(HttpRequestBuilder requestBuilder, UTorre
|
|||||||
throw new DownloadClientException("Unable to connect to Deluge, please check your settings", ex);
|
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);
|
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 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();
|
cookies = response.GetCookies();
|
||||||
|
Loading…
Reference in New Issue
Block a user