1
0
mirror of https://github.com/Radarr/Radarr.git synced 2024-09-11 12:02:35 +02:00

Fixed: Show TLS errors in UI when testing download clients

This commit is contained in:
Mark McDowall 2020-10-25 15:59:40 -07:00 committed by Qstick
parent 216f9b37b2
commit bab9b2c040
17 changed files with 90 additions and 13 deletions

View File

@ -270,7 +270,11 @@ private ValidationFailure TestConnection()
catch (Exception ex)
{
_logger.Error(ex, "Failed to test connection");
return new NzbDroneValidationFailure(string.Empty, "Unknown exception: " + ex.Message);
return new NzbDroneValidationFailure("Host", "Unable to connect to Deluge")
{
DetailedDescription = ex.Message
};
}
return null;

View File

@ -267,6 +267,11 @@ private JsonRpcResponse<TResult> ExecuteRequest<TResult>(JsonRpcRequestBuilder r
}
catch (WebException ex)
{
if (ex.Status == WebExceptionStatus.TrustFailure)
{
throw new DownloadClientUnavailableException("Unable to connect to Deluge, certificate validation failed.", ex);
}
throw new DownloadClientUnavailableException("Unable to connect to Deluge, please check your settings", ex);
}
}

View File

@ -85,6 +85,11 @@ private DiskStationResponse<T> ProcessRequest<T>(HttpRequestBuilder requestBuild
}
catch (WebException ex)
{
if (ex.Status == WebExceptionStatus.TrustFailure)
{
throw new DownloadClientUnavailableException("Unable to connect to Diskstation, certificate validation failed.", ex);
}
throw new DownloadClientUnavailableException("Unable to connect to Diskstation, please check your settings", ex);
}

View File

@ -389,7 +389,11 @@ protected ValidationFailure TestConnection()
catch (Exception ex)
{
_logger.Error(ex, "Error testing Torrent Download Station");
return new NzbDroneValidationFailure(string.Empty, $"Unknown exception: {ex.Message}");
return new NzbDroneValidationFailure("Host", "Unable to connect to Torrent Download Station")
{
DetailedDescription = ex.Message
};
}
}

View File

@ -287,7 +287,11 @@ protected ValidationFailure TestConnection()
catch (Exception ex)
{
_logger.Error(ex, "Error testing Torrent Download Station");
return new NzbDroneValidationFailure(string.Empty, "Unknown exception: " + ex.Message);
return new NzbDroneValidationFailure("Host", "Unable to connect to Usenet Download Station")
{
DetailedDescription = ex.Message
};
}
}

View File

@ -171,7 +171,8 @@ private ValidationFailure TestConnection()
if (version < new Version("5.1"))
{
return new ValidationFailure(string.Empty, "Old Hadouken client with unsupported API, need 5.1 or higher");
return new ValidationFailure(string.Empty,
"Old Hadouken client with unsupported API, need 5.1 or higher");
}
}
catch (DownloadClientAuthenticationException ex)
@ -180,6 +181,13 @@ private ValidationFailure TestConnection()
return new NzbDroneValidationFailure("Password", "Authentication failed");
}
catch (Exception ex)
{
return new NzbDroneValidationFailure("Host", "Unable to connect to Hadouken")
{
DetailedDescription = ex.Message
};
}
return null;
}

View File

@ -89,6 +89,11 @@ private T ProcessRequest<T>(HadoukenSettings settings, string method, params obj
}
catch (WebException ex)
{
if (ex.Status == WebExceptionStatus.TrustFailure)
{
throw new DownloadClientUnavailableException("Unable to connect to Hadouken, certificate validation failed.", ex);
}
throw new DownloadClientUnavailableException("Unable to connect to Hadouken, please check your settings", ex);
}

View File

@ -173,8 +173,12 @@ private ValidationFailure TestConnection()
}
catch (Exception ex)
{
_logger.Error(ex, ex.Message);
return new ValidationFailure("Host", "Unable to connect to NZBVortex");
_logger.Error(ex, "Unable to connect to NZBVortex");
return new NzbDroneValidationFailure("Host", "Unable to connect to NZBVortex")
{
DetailedDescription = ex.Message
};
}
return null;

View File

@ -165,6 +165,11 @@ private T ProcessRequest<T>(HttpRequestBuilder requestBuilder, bool requiresAuth
}
catch (WebException ex)
{
if (ex.Status == WebExceptionStatus.TrustFailure)
{
throw new DownloadClientUnavailableException("Unable to connect to NZBVortex, certificate validation failed.", ex);
}
throw new DownloadClientUnavailableException("Unable to connect to NZBVortex, please check your settings", ex);
}
}

View File

@ -318,7 +318,11 @@ private ValidationFailure TestConnection()
catch (Exception ex)
{
_logger.Error(ex, "Unable to test qBittorrent");
return new NzbDroneValidationFailure(string.Empty, "Unknown exception: " + ex.Message);
return new NzbDroneValidationFailure("Host", "Unable to connect to qBittorrent")
{
DetailedDescription = ex.Message
};
}
return null;

View File

@ -54,6 +54,11 @@ public bool IsApiSupported(QBittorrentSettings settings)
}
catch (WebException ex)
{
if (ex.Status == WebExceptionStatus.TrustFailure)
{
throw new DownloadClientUnavailableException("Unable to connect to qBittorrent, certificate validation failed.", ex);
}
throw new DownloadClientException("Failed to connect to qBittorrent, check your settings.", ex);
}
}

View File

@ -273,14 +273,15 @@ protected ValidationFailure TestConnection()
{
_logger.Error(ex, ex.Message);
return new NzbDroneValidationFailure("Host", "Unable to connect")
{
DetailedDescription = "Please verify the hostname and port."
};
return new NzbDroneValidationFailure("Host", "Unable to connect to Transmission")
{
DetailedDescription = ex.Message
};
}
catch (Exception ex)
{
_logger.Error(ex, "Failed to test");
return new NzbDroneValidationFailure(string.Empty, "Unknown exception: " + ex.Message);
}
}

View File

@ -308,6 +308,11 @@ public TransmissionResponse ProcessRequest(string action, object arguments, Tran
}
catch (WebException ex)
{
if (ex.Status == WebExceptionStatus.TrustFailure)
{
throw new DownloadClientUnavailableException("Unable to connect to Transmission, certificate validation failed.", ex);
}
throw new DownloadClientUnavailableException("Unable to connect to Transmission, please check your settings", ex);
}
}

View File

@ -210,7 +210,11 @@ private ValidationFailure TestConnection()
catch (Exception ex)
{
_logger.Error(ex, "Failed to test rTorrent");
return new NzbDroneValidationFailure(string.Empty, "Unknown exception: " + ex.Message);
return new NzbDroneValidationFailure("Host", "Unable to connect to rTorrent")
{
DetailedDescription = ex.Message
};
}
return null;

View File

@ -267,6 +267,11 @@ private T ExecuteRequest<T>(Func<T> task)
}
catch (WebException ex)
{
if (ex.Status == WebExceptionStatus.TrustFailure)
{
throw new DownloadClientUnavailableException("Unable to connect to rTorrent, certificate validation failed.", ex);
}
throw new DownloadClientUnavailableException("Unable to connect to rTorrent, please check your settings", ex);
}
}

View File

@ -293,7 +293,11 @@ private ValidationFailure TestConnection()
catch (Exception ex)
{
_logger.Error(ex, "Failed to test uTorrent");
return new NzbDroneValidationFailure(string.Empty, "Unknown exception: " + ex.Message);
return new NzbDroneValidationFailure("Host", "Unable to connect to uTorrent")
{
DetailedDescription = ex.Message
};
}
return null;

View File

@ -231,6 +231,11 @@ public UTorrentResponse ProcessRequest(HttpRequestBuilder requestBuilder, UTorre
}
catch (WebException ex)
{
if (ex.Status == WebExceptionStatus.TrustFailure)
{
throw new DownloadClientUnavailableException("Unable to connect to uTorrent, certificate validation failed.", ex);
}
throw new DownloadClientException("Unable to connect to uTorrent, please check your settings", ex);
}