From da1210c6a662db0ebbe70aca09cc9cbdfaeb1fcd Mon Sep 17 00:00:00 2001 From: Mark McDowall Date: Sun, 26 Jul 2020 10:49:15 -0700 Subject: [PATCH] Fixed: Show more information in UI when testing SAB fails in some cases --- .../src/Components/Form/FormInputGroup.js | 4 ++-- .../src/Components/Form/FormInputHelpText.css | 4 ++++ .../src/Components/Form/FormInputHelpText.js | 21 ++++++++++++++----- .../Download/Clients/Sabnzbd/Sabnzbd.cs | 5 ++++- .../Download/Clients/Sabnzbd/SabnzbdProxy.cs | 9 ++++++-- 5 files changed, 33 insertions(+), 10 deletions(-) diff --git a/frontend/src/Components/Form/FormInputGroup.js b/frontend/src/Components/Form/FormInputGroup.js index 838278709..44cc0b900 100644 --- a/frontend/src/Components/Form/FormInputGroup.js +++ b/frontend/src/Components/Form/FormInputGroup.js @@ -207,7 +207,7 @@ function FormInputGroup(props) { key={index} text={error.message} link={error.link} - linkTooltip={error.detailedMessage} + tooltip={error.detailedMessage} isError={true} isCheckInput={checkInput} /> @@ -222,7 +222,7 @@ function FormInputGroup(props) { key={index} text={warning.message} link={warning.link} - linkTooltip={warning.detailedMessage} + tooltip={warning.detailedMessage} isWarning={true} isCheckInput={checkInput} /> diff --git a/frontend/src/Components/Form/FormInputHelpText.css b/frontend/src/Components/Form/FormInputHelpText.css index 7fd957233..756fd90db 100644 --- a/frontend/src/Components/Form/FormInputHelpText.css +++ b/frontend/src/Components/Form/FormInputHelpText.css @@ -37,3 +37,7 @@ margin-left: 5px; } + +.details { + margin-left: 5px; +} diff --git a/frontend/src/Components/Form/FormInputHelpText.js b/frontend/src/Components/Form/FormInputHelpText.js index f562af8ee..00024684e 100644 --- a/frontend/src/Components/Form/FormInputHelpText.js +++ b/frontend/src/Components/Form/FormInputHelpText.js @@ -11,7 +11,7 @@ function FormInputHelpText(props) { className, text, link, - linkTooltip, + tooltip, isError, isWarning, isCheckInput @@ -28,16 +28,27 @@ function FormInputHelpText(props) { {text} { - !!link && + link ? - + : + null + } + + { + !link && tooltip ? + : + null } ); @@ -47,7 +58,7 @@ FormInputHelpText.propTypes = { className: PropTypes.string.isRequired, text: PropTypes.string.isRequired, link: PropTypes.string, - linkTooltip: PropTypes.string, + tooltip: PropTypes.string, isError: PropTypes.bool, isWarning: PropTypes.bool, isCheckInput: PropTypes.bool diff --git a/src/NzbDrone.Core/Download/Clients/Sabnzbd/Sabnzbd.cs b/src/NzbDrone.Core/Download/Clients/Sabnzbd/Sabnzbd.cs index d719d495e..8813f68fb 100644 --- a/src/NzbDrone.Core/Download/Clients/Sabnzbd/Sabnzbd.cs +++ b/src/NzbDrone.Core/Download/Clients/Sabnzbd/Sabnzbd.cs @@ -378,7 +378,10 @@ namespace NzbDrone.Core.Download.Clients.Sabnzbd catch (Exception ex) { _logger.Error(ex, ex.Message); - return new ValidationFailure("Host", "Unable to connect to SABnzbd"); + return new NzbDroneValidationFailure("Host", "Unable to connect to SABnzbd") + { + DetailedDescription = ex.Message + }; } } diff --git a/src/NzbDrone.Core/Download/Clients/Sabnzbd/SabnzbdProxy.cs b/src/NzbDrone.Core/Download/Clients/Sabnzbd/SabnzbdProxy.cs index f725e303d..6cee2a4d1 100644 --- a/src/NzbDrone.Core/Download/Clients/Sabnzbd/SabnzbdProxy.cs +++ b/src/NzbDrone.Core/Download/Clients/Sabnzbd/SabnzbdProxy.cs @@ -186,11 +186,16 @@ namespace NzbDrone.Core.Download.Clients.Sabnzbd } catch (HttpException ex) { - throw new DownloadClientException("Unable to connect to SABnzbd, please check your settings", ex); + throw new DownloadClientException("Unable to connect to SABnzbd, {0}", ex, ex.Message); } catch (WebException ex) { - throw new DownloadClientUnavailableException("Unable to connect to SABnzbd, please check your settings", ex); + if (ex.Status == WebExceptionStatus.TrustFailure) + { + throw new DownloadClientUnavailableException("Unable to connect to SABnzbd, certificate validation failed.", ex); + } + + throw new DownloadClientUnavailableException("Unable to connect to SABnzbd, {0}", ex, ex.Message); } CheckForError(response);