Add exceptions to logs for indexers and apps

pull/1995/head v1.13.0.4217
Bogdan 4 months ago
parent 70a5dae293
commit cfdf88a1e2

@ -252,11 +252,11 @@ namespace NzbDrone.Core.Applications
if (webException.Message.Contains("502") || webException.Message.Contains("503") || if (webException.Message.Contains("502") || webException.Message.Contains("503") ||
webException.Message.Contains("timed out")) 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 else
{ {
_logger.Warn("{0} {1}", this, webException.Message); _logger.Warn(webException, "{0} {1}", this, webException.Message);
} }
} }
catch (TooManyRequestsException ex) catch (TooManyRequestsException ex)
@ -264,12 +264,12 @@ namespace NzbDrone.Core.Applications
var minimumBackOff = ex.RetryAfter != TimeSpan.Zero ? ex.RetryAfter : TimeSpan.FromHours(1); var minimumBackOff = ex.RetryAfter != TimeSpan.Zero ? ex.RetryAfter : TimeSpan.FromHours(1);
_applicationStatusService.RecordFailure(application.Definition.Id, minimumBackOff); _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) catch (HttpException ex)
{ {
_applicationStatusService.RecordFailure(application.Definition.Id); _applicationStatusService.RecordFailure(application.Definition.Id);
_logger.Warn("{0} {1}", this, ex.Message); _logger.Warn(ex, "{0} {1}", this, ex.Message);
} }
catch (Exception ex) catch (Exception ex)
{ {
@ -301,11 +301,11 @@ namespace NzbDrone.Core.Applications
if (webException.Message.Contains("502") || webException.Message.Contains("503") || if (webException.Message.Contains("502") || webException.Message.Contains("503") ||
webException.Message.Contains("timed out")) 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 else
{ {
_logger.Warn("{0} {1}", this, webException.Message); _logger.Warn(webException, "{0} {1}", this, webException.Message);
} }
} }
catch (TooManyRequestsException ex) catch (TooManyRequestsException ex)
@ -313,12 +313,12 @@ namespace NzbDrone.Core.Applications
var minimumBackOff = ex.RetryAfter != TimeSpan.Zero ? ex.RetryAfter : TimeSpan.FromHours(1); var minimumBackOff = ex.RetryAfter != TimeSpan.Zero ? ex.RetryAfter : TimeSpan.FromHours(1);
_applicationStatusService.RecordFailure(application.Definition.Id, minimumBackOff); _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) catch (HttpException ex)
{ {
_applicationStatusService.RecordFailure(application.Definition.Id); _applicationStatusService.RecordFailure(application.Definition.Id);
_logger.Warn("{0} {1}", this, ex.Message); _logger.Warn(ex, "{0} {1}", this, ex.Message);
} }
catch (Exception ex) catch (Exception ex)
{ {

@ -388,11 +388,11 @@ namespace NzbDrone.Core.Indexers
if (webException.Message.Contains("502") || webException.Message.Contains("503") || if (webException.Message.Contains("502") || webException.Message.Contains("503") ||
webException.Message.Contains("504") || webException.Message.Contains("timed out")) webException.Message.Contains("504") || webException.Message.Contains("timed out"))
{ {
_logger.Warn("{0} server is currently unavailable. {1} {2}", this, url, webException.Message); _logger.Warn(webException, "{0} server is currently unavailable. {1} {2}", this, url, webException.Message);
} }
else else
{ {
_logger.Warn("{0} {1} {2}", this, url, webException.Message); _logger.Warn(webException, "{0} {1} {2}", this, url, webException.Message);
} }
} }
catch (TooManyRequestsException ex) catch (TooManyRequestsException ex)
@ -402,7 +402,7 @@ namespace NzbDrone.Core.Indexers
var retryTime = ex.RetryAfter != TimeSpan.Zero ? ex.RetryAfter : minimumBackoff; var retryTime = ex.RetryAfter != TimeSpan.Zero ? ex.RetryAfter : minimumBackoff;
_indexerStatusService.RecordFailure(Definition.Id, retryTime); _indexerStatusService.RecordFailure(Definition.Id, retryTime);
_logger.Warn("Request Limit reached for {0}. Disabled for {1}", this, retryTime); _logger.Warn(ex, "Request Limit reached for {0}. Disabled for {1}", this, retryTime);
} }
catch (HttpException ex) catch (HttpException ex)
{ {
@ -411,18 +411,18 @@ namespace NzbDrone.Core.Indexers
if (ex.Response.HasHttpServerError) if (ex.Response.HasHttpServerError)
{ {
_logger.Warn("Unable to connect to {0} at [{1}]. Indexer's server is unavailable. Try again later. {2}", this, url, ex.Message); _logger.Warn(ex, "Unable to connect to {0} at [{1}]. Indexer's server is unavailable. Try again later. {2}", this, url, ex.Message);
} }
else else
{ {
_logger.Warn("{0} {1}", this, ex.Message); _logger.Warn(ex, "{0} {1}", this, ex.Message);
} }
} }
catch (RequestLimitReachedException ex) catch (RequestLimitReachedException ex)
{ {
result.Queries.Add(new IndexerQueryResult { Response = ex.Response.HttpResponse }); result.Queries.Add(new IndexerQueryResult { Response = ex.Response.HttpResponse });
_indexerStatusService.RecordFailure(Definition.Id, minimumBackoff); _indexerStatusService.RecordFailure(Definition.Id, minimumBackoff);
_logger.Warn("Request Limit reached for {0}. Disabled for {1}", this, minimumBackoff); _logger.Warn(ex, "Request Limit reached for {0}. Disabled for {1}", this, minimumBackoff);
} }
catch (IndexerAuthException ex) catch (IndexerAuthException ex)
{ {

Loading…
Cancel
Save