From 6b6ff4fe76c6eb5e976e0ddc4104e43e6bb7c2a9 Mon Sep 17 00:00:00 2001 From: Bogdan Date: Sun, 19 May 2024 18:20:11 +0300 Subject: [PATCH] New: Link to "Why Searches Could be Failing" wiki section --- frontend/src/Search/AddNewItem.js | 14 +++++++++++--- src/NzbDrone.Core/Localization/Core/en.json | 2 ++ .../MetadataSource/BookInfo/BookInfoProxy.cs | 14 +++++++++----- 3 files changed, 22 insertions(+), 8 deletions(-) diff --git a/frontend/src/Search/AddNewItem.js b/frontend/src/Search/AddNewItem.js index f46d6b6c4..1f1a87fc7 100644 --- a/frontend/src/Search/AddNewItem.js +++ b/frontend/src/Search/AddNewItem.js @@ -1,5 +1,6 @@ import PropTypes from 'prop-types'; import React, { Component } from 'react'; +import Alert from 'Components/Alert'; import TextInput from 'Components/Form/TextInput'; import Icon from 'Components/Icon'; import Button from 'Components/Link/Button'; @@ -7,7 +8,7 @@ import Link from 'Components/Link/Link'; import LoadingIndicator from 'Components/Loading/LoadingIndicator'; import PageContent from 'Components/Page/PageContent'; import PageContentBody from 'Components/Page/PageContentBody'; -import { icons } from 'Helpers/Props'; +import { icons, kinds } from 'Helpers/Props'; import getErrorMessage from 'Utilities/Object/getErrorMessage'; import translate from 'Utilities/String/translate'; import AddNewAuthorSearchResultConnector from './Author/AddNewAuthorSearchResultConnector'; @@ -127,9 +128,16 @@ class AddNewItem extends Component { !isFetching && !!error ?
- Failed to load search results, please try again. + {translate('FailedLoadingSearchResults')} +
+ + {getErrorMessage(error)} + +
+ + {translate('WhySearchesCouldBeFailing')} +
-
{getErrorMessage(error)}
: null } diff --git a/src/NzbDrone.Core/Localization/Core/en.json b/src/NzbDrone.Core/Localization/Core/en.json index db263e5ff..586985ab2 100644 --- a/src/NzbDrone.Core/Localization/Core/en.json +++ b/src/NzbDrone.Core/Localization/Core/en.json @@ -348,6 +348,7 @@ "ExtraFileExtensionsHelpText": "Comma separated list of extra files to import (.nfo will be imported as .nfo-orig)", "ExtraFileExtensionsHelpTextsExamples": "Examples: '.sub, .nfo' or 'sub,nfo'", "FailedDownloadHandling": "Failed Download Handling", + "FailedLoadingSearchResults": "Failed to load search results, please try again.", "FailedToLoadQueue": "Failed to load Queue", "FileDateHelpText": "Change file date on import/rescan", "FileDetails": "File Details", @@ -1073,6 +1074,7 @@ "WatchRootFoldersForFileChanges": "Watch Root Folders for file changes", "WeekColumnHeader": "Week Column Header", "WhatsNew": "What's New?", + "WhySearchesCouldBeFailing": "Click here to find out why searches could be failing", "WouldYouLikeToRestoreBackup": "Would you like to restore the backup '{name}'?", "WriteAudioTags": "Tag Audio Files with Metadata", "WriteAudioTagsScrub": "Scrub Existing Tags", diff --git a/src/NzbDrone.Core/MetadataSource/BookInfo/BookInfoProxy.cs b/src/NzbDrone.Core/MetadataSource/BookInfo/BookInfoProxy.cs index c77aec858..9cd65ae93 100644 --- a/src/NzbDrone.Core/MetadataSource/BookInfo/BookInfoProxy.cs +++ b/src/NzbDrone.Core/MetadataSource/BookInfo/BookInfoProxy.cs @@ -218,13 +218,12 @@ namespace NzbDrone.Core.MetadataSource.BookInfo catch (HttpException ex) { _logger.Warn(ex, ex.Message); - throw new GoodreadsException("Search for '{0}' failed. Unable to communicate with Goodreads.", title); + throw new GoodreadsException("Search for '{0}' failed. Unable to communicate with Goodreads.", ex, title); } - catch (Exception ex) + catch (Exception ex) when (ex is not BookInfoException) { _logger.Warn(ex, ex.Message); - throw new GoodreadsException("Search for '{0}' failed. Invalid response received from Goodreads.", - title); + throw new GoodreadsException("Search for '{0}' failed. Invalid response received from Goodreads.", ex, title); } } @@ -296,6 +295,11 @@ namespace NzbDrone.Core.MetadataSource.BookInfo { return MapSearchResult(ids); } + catch (HttpException ex) + { + _logger.Warn(ex); + throw new BookInfoException("Search for '{0}' failed. Unable to communicate with ReadarrAPI, returning status code: {1}.", ex, query, ex.Response.StatusCode); + } catch (Exception e) { _logger.Warn(e, "Error mapping search results"); @@ -484,7 +488,7 @@ namespace NzbDrone.Core.MetadataSource.BookInfo httpRequest.ContentSummary = ids.ToJson(Formatting.None); httpRequest.AllowAutoRedirect = true; - httpRequest.SuppressHttpError = true; + httpRequest.SuppressHttpErrorStatusCodes = new[] { HttpStatusCode.TooManyRequests }; httpResponse = _httpClient.Post(httpRequest);