From cfdf88a1e2a8b7a89f2375a9afbad881eaf601c9 Mon Sep 17 00:00:00 2001 From: Bogdan Date: Sat, 20 Jan 2024 04:46:35 +0200 Subject: [PATCH] Add exceptions to logs for indexers and apps --- .../Applications/ApplicationService.cs | 16 ++++++++-------- src/NzbDrone.Core/Indexers/HttpIndexerBase.cs | 12 ++++++------ 2 files changed, 14 insertions(+), 14 deletions(-) diff --git a/src/NzbDrone.Core/Applications/ApplicationService.cs b/src/NzbDrone.Core/Applications/ApplicationService.cs index 097b701d1..97e627fd9 100644 --- a/src/NzbDrone.Core/Applications/ApplicationService.cs +++ b/src/NzbDrone.Core/Applications/ApplicationService.cs @@ -252,11 +252,11 @@ private void ExecuteAction(Action applicationAction, IApplication if (webException.Message.Contains("502") || webException.Message.Contains("503") || webException.Message.Contains("timed out")) { - _logger.Warn("{0} server is currently unavailable. {1}", this, webException.Message); + _logger.Warn(webException, "{0} server is currently unavailable. {1}", this, webException.Message); } else { - _logger.Warn("{0} {1}", this, webException.Message); + _logger.Warn(webException, "{0} {1}", this, webException.Message); } } catch (TooManyRequestsException ex) @@ -264,12 +264,12 @@ private void ExecuteAction(Action applicationAction, IApplication var minimumBackOff = ex.RetryAfter != TimeSpan.Zero ? ex.RetryAfter : TimeSpan.FromHours(1); _applicationStatusService.RecordFailure(application.Definition.Id, minimumBackOff); - _logger.Warn("API Request Limit reached for {0}", this); + _logger.Warn(ex, "API Request Limit reached for {0}", this); } catch (HttpException ex) { _applicationStatusService.RecordFailure(application.Definition.Id); - _logger.Warn("{0} {1}", this, ex.Message); + _logger.Warn(ex, "{0} {1}", this, ex.Message); } catch (Exception ex) { @@ -301,11 +301,11 @@ private TResult ExecuteAction(Func applicationAc if (webException.Message.Contains("502") || webException.Message.Contains("503") || webException.Message.Contains("timed out")) { - _logger.Warn("{0} server is currently unavailable. {1}", this, webException.Message); + _logger.Warn(webException, "{0} server is currently unavailable. {1}", this, webException.Message); } else { - _logger.Warn("{0} {1}", this, webException.Message); + _logger.Warn(webException, "{0} {1}", this, webException.Message); } } catch (TooManyRequestsException ex) @@ -313,12 +313,12 @@ private TResult ExecuteAction(Func applicationAc var minimumBackOff = ex.RetryAfter != TimeSpan.Zero ? ex.RetryAfter : TimeSpan.FromHours(1); _applicationStatusService.RecordFailure(application.Definition.Id, minimumBackOff); - _logger.Warn("API Request Limit reached for {0}", this); + _logger.Warn(ex, "API Request Limit reached for {0}", this); } catch (HttpException ex) { _applicationStatusService.RecordFailure(application.Definition.Id); - _logger.Warn("{0} {1}", this, ex.Message); + _logger.Warn(ex, "{0} {1}", this, ex.Message); } catch (Exception ex) { diff --git a/src/NzbDrone.Core/Indexers/HttpIndexerBase.cs b/src/NzbDrone.Core/Indexers/HttpIndexerBase.cs index ed25df68c..ab921a1a7 100644 --- a/src/NzbDrone.Core/Indexers/HttpIndexerBase.cs +++ b/src/NzbDrone.Core/Indexers/HttpIndexerBase.cs @@ -388,11 +388,11 @@ protected virtual async Task FetchReleases(Func FetchReleases(Func FetchReleases(Func