From 05735ad2c3972d40d758f9322cce0211ea9cac82 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 393a6b0ba..7fc3ffd99 100644 --- a/frontend/src/Components/Form/FormInputGroup.js +++ b/frontend/src/Components/Form/FormInputGroup.js @@ -210,7 +210,7 @@ function FormInputGroup(props) { key={index} text={error.message} link={error.link} - linkTooltip={error.detailedMessage} + tooltip={error.detailedMessage} isError={true} isCheckInput={checkInput} /> @@ -225,7 +225,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 d9195568b..404bd8a03 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 d5a7d2cbb..fb76d2731 100644 --- a/src/NzbDrone.Core/Download/Clients/Sabnzbd/Sabnzbd.cs +++ b/src/NzbDrone.Core/Download/Clients/Sabnzbd/Sabnzbd.cs @@ -376,7 +376,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 0f5234727..53a1b9979 100644 --- a/src/NzbDrone.Core/Download/Clients/Sabnzbd/SabnzbdProxy.cs +++ b/src/NzbDrone.Core/Download/Clients/Sabnzbd/SabnzbdProxy.cs @@ -185,11 +185,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);