Fixed: Show TLS errors in UI when testing download clients

Closes #4021
This commit is contained in:
Mark McDowall 2020-10-25 15:59:40 -07:00
parent 3fc3aef268
commit 91c395d0c6
17 changed files with 89 additions and 12 deletions

View File

@ -260,7 +260,11 @@ namespace NzbDrone.Core.Download.Clients.Deluge
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

@ -263,6 +263,11 @@ namespace NzbDrone.Core.Download.Clients.Deluge
}
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

@ -84,6 +84,11 @@ namespace NzbDrone.Core.Download.Clients.DownloadStation.Proxies
}
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

@ -379,7 +379,11 @@ namespace NzbDrone.Core.Download.Clients.DownloadStation
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

@ -278,7 +278,11 @@ namespace NzbDrone.Core.Download.Clients.DownloadStation
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

@ -155,7 +155,8 @@ namespace NzbDrone.Core.Download.Clients.Hadouken
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)
@ -164,6 +165,13 @@ namespace NzbDrone.Core.Download.Clients.Hadouken
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

@ -90,6 +90,11 @@ namespace NzbDrone.Core.Download.Clients.Hadouken
}
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

@ -160,7 +160,11 @@ namespace NzbDrone.Core.Download.Clients.NzbVortex
catch (Exception ex)
{
_logger.Error(ex, "Unable to connect to NZBVortex");
return new ValidationFailure("Host", "Unable to connect to NZBVortex");
return new NzbDroneValidationFailure("Host", "Unable to connect to NZBVortex")
{
DetailedDescription = ex.Message
};
}
return null;

View File

@ -166,6 +166,11 @@ namespace NzbDrone.Core.Download.Clients.NzbVortex
}
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

@ -307,7 +307,11 @@ namespace NzbDrone.Core.Download.Clients.QBittorrent
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

@ -55,6 +55,11 @@ namespace NzbDrone.Core.Download.Clients.QBittorrent
}
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

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

View File

@ -305,6 +305,11 @@ namespace NzbDrone.Core.Download.Clients.Transmission
}
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

@ -200,7 +200,11 @@ namespace NzbDrone.Core.Download.Clients.RTorrent
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

@ -266,6 +266,11 @@ namespace NzbDrone.Core.Download.Clients.RTorrent
}
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

@ -286,7 +286,11 @@ namespace NzbDrone.Core.Download.Clients.UTorrent
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

@ -228,6 +228,11 @@ namespace NzbDrone.Core.Download.Clients.UTorrent
}
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);
}