Log content on error at ProcessContent

This commit is contained in:
pcjones
2024-10-25 13:26:43 +02:00
parent 7ed68f2b84
commit 03b50a24fd

View File

@@ -1,12 +1,13 @@
using Microsoft.AspNetCore.Mvc; using Microsoft.AspNetCore.Mvc;
using System.Text; using System.Text;
using UmlautAdaptarr.Models; using UmlautAdaptarr.Models;
using UmlautAdaptarr.Providers;
using UmlautAdaptarr.Services; using UmlautAdaptarr.Services;
using UmlautAdaptarr.Utilities; using UmlautAdaptarr.Utilities;
namespace UmlautAdaptarr.Controllers namespace UmlautAdaptarr.Controllers
{ {
public abstract class SearchControllerBase(ProxyRequestService proxyRequestService, TitleMatchingService titleMatchingService) : ControllerBase public abstract class SearchControllerBase(ProxyRequestService proxyRequestService, TitleMatchingService titleMatchingService, ILogger<SearchControllerBase> logger) : ControllerBase
{ {
// TODO evaluate if this should be set to true by default // TODO evaluate if this should be set to true by default
private readonly bool TODO_FORCE_TEXT_SEARCH_ORIGINAL_TITLE = true; private readonly bool TODO_FORCE_TEXT_SEARCH_ORIGINAL_TITLE = true;
@@ -109,9 +110,17 @@ namespace UmlautAdaptarr.Controllers
private string ProcessContent(string content, SearchItem? searchItem) private string ProcessContent(string content, SearchItem? searchItem)
{
try
{ {
return titleMatchingService.RenameTitlesInContent(content, searchItem); return titleMatchingService.RenameTitlesInContent(content, searchItem);
} }
catch (Exception ex)
{
logger.LogError($"Error at ProcessContent: {ex.Message}{Environment.NewLine}Content:{Environment.NewLine}{content}");
}
return null;
}
public async Task<AggregatedSearchResult> AggregateSearchResults( public async Task<AggregatedSearchResult> AggregateSearchResults(
string domain, string domain,