From 1eb278c7f6bf4120ee46ab760093557abbde15d7 Mon Sep 17 00:00:00 2001 From: "kay.one" Date: Tue, 30 Jul 2013 22:35:07 -0700 Subject: [PATCH] less aggressive http exception logging. --- NzbDrone.Common/HttpProvider.cs | 37 ++++++++++++------- NzbDrone.Core/MediaCover/MediaCoverService.cs | 2 +- NzbDrone.Core/Parser/Parser.cs | 2 - 3 files changed, 24 insertions(+), 17 deletions(-) diff --git a/NzbDrone.Common/HttpProvider.cs b/NzbDrone.Common/HttpProvider.cs index 97513f984..61e311574 100644 --- a/NzbDrone.Common/HttpProvider.cs +++ b/NzbDrone.Common/HttpProvider.cs @@ -11,9 +11,9 @@ namespace NzbDrone.Common { public interface IHttpProvider { - string DownloadString(string address); - string DownloadString(string address, string username, string password); - string DownloadString(string address, ICredentials identity); + string DownloadString(string url); + string DownloadString(string url, string username, string password); + string DownloadString(string url, ICredentials identity); Dictionary GetHeader(string url); Stream DownloadStream(string url, NetworkCredential credential = null); @@ -34,27 +34,32 @@ namespace NzbDrone.Common _userAgent = String.Format("NzbDrone {0}", BuildInfo.Version); } - public string DownloadString(string address) + public string DownloadString(string url) { - return DownloadString(address, null); + return DownloadString(url, null); } - public string DownloadString(string address, string username, string password) + public string DownloadString(string url, string username, string password) { - return DownloadString(address, new NetworkCredential(username, password)); + return DownloadString(url, new NetworkCredential(username, password)); } - public string DownloadString(string address, ICredentials identity) + public string DownloadString(string url, ICredentials identity) { try { var client = new WebClient { Credentials = identity }; client.Headers.Add(HttpRequestHeader.UserAgent, _userAgent); - return client.DownloadString(address); + return client.DownloadString(url); } - catch (Exception ex) + catch (WebException e) { - logger.Trace(ex.Message, ex.ToString()); + logger.Warn("Failed to get response from: {0} {1}", url, e.Message); + throw; + } + catch (Exception e) + { + logger.WarnException("Failed to get response from: " + url, e); throw; } } @@ -106,10 +111,14 @@ namespace NzbDrone.Common stopWatch.Stop(); logger.Trace("Downloading Completed. took {0:0}s", stopWatch.Elapsed.Seconds); } - catch (Exception ex) + catch (WebException e) + { + logger.Warn("Failed to get response from: {0} {1}", url, e.Message); + throw; + } + catch (Exception e) { - logger.Warn("Failed to get response from: {0}", url); - logger.TraceException(ex.Message, ex); + logger.WarnException("Failed to get response from: " + url, e); throw; } } diff --git a/NzbDrone.Core/MediaCover/MediaCoverService.cs b/NzbDrone.Core/MediaCover/MediaCoverService.cs index 4bb237aa4..99f10e4e7 100644 --- a/NzbDrone.Core/MediaCover/MediaCoverService.cs +++ b/NzbDrone.Core/MediaCover/MediaCoverService.cs @@ -62,7 +62,7 @@ namespace NzbDrone.Core.MediaCover } catch (WebException e) { - _logger.WarnException("Couldn't download media cover for " + series, e); + _logger.Warn("Couldn't download media cover for " + series); } catch (Exception e) { diff --git a/NzbDrone.Core/Parser/Parser.cs b/NzbDrone.Core/Parser/Parser.cs index 99f15c8ce..8ef1857a9 100644 --- a/NzbDrone.Core/Parser/Parser.cs +++ b/NzbDrone.Core/Parser/Parser.cs @@ -115,8 +115,6 @@ namespace NzbDrone.Core.Parser if (match.Count != 0) { - Logger.Trace("Matching Regex: '{0}'", regex.ToString()); - var result = ParseMatchCollection(match); if (result != null) {