From a445747c4dd4904ce490772d193395e61df3ee11 Mon Sep 17 00:00:00 2001 From: Qstick Date: Mon, 18 Sep 2023 03:09:12 -0400 Subject: [PATCH] Fixed: Show correct error on unauthorized caps call (cherry picked from commit f2b0fc946e1fb1b4649f1b46a003bd2add09a461) --- .../Indexers/Newznab/NewznabCapabilitiesProvider.cs | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/src/NzbDrone.Core/Indexers/Newznab/NewznabCapabilitiesProvider.cs b/src/NzbDrone.Core/Indexers/Newznab/NewznabCapabilitiesProvider.cs index 5de9805b7..34f8e7d5f 100644 --- a/src/NzbDrone.Core/Indexers/Newznab/NewznabCapabilitiesProvider.cs +++ b/src/NzbDrone.Core/Indexers/Newznab/NewznabCapabilitiesProvider.cs @@ -7,6 +7,7 @@ using NzbDrone.Common.Cache; using NzbDrone.Common.Extensions; using NzbDrone.Common.Http; using NzbDrone.Common.Serializer; +using NzbDrone.Core.Indexers.Exceptions; namespace NzbDrone.Core.Indexers.Newznab { @@ -73,6 +74,13 @@ namespace NzbDrone.Core.Indexers.Newznab _logger.Debug(ex, "Failed to parse newznab api capabilities for {0}", indexerSettings.BaseUrl); throw; } + catch (ApiKeyException ex) + { + ex.WithData(response, 128 * 1024); + _logger.Trace("Unexpected Response content ({0} bytes): {1}", response.ResponseData.Length, response.Content); + _logger.Debug(ex, "Failed to parse newznab api capabilities for {0}, invalid API key", indexerSettings.BaseUrl); + throw; + } catch (Exception ex) { ex.WithData(response, 128 * 1024);