From 84857f286a20124f76edfb5966d58484ccfbc911 Mon Sep 17 00:00:00 2001 From: "kay.one" Date: Thu, 29 Aug 2013 19:00:40 -0700 Subject: [PATCH] handle exceptions when getting header for covers fail. --- NzbDrone.Core/MediaCover/MediaCoverService.cs | 33 ++++++++++--------- 1 file changed, 17 insertions(+), 16 deletions(-) diff --git a/NzbDrone.Core/MediaCover/MediaCoverService.cs b/NzbDrone.Core/MediaCover/MediaCoverService.cs index 99f10e4e7..b14a6bcb3 100644 --- a/NzbDrone.Core/MediaCover/MediaCoverService.cs +++ b/NzbDrone.Core/MediaCover/MediaCoverService.cs @@ -44,30 +44,31 @@ namespace NzbDrone.Core.MediaCover foreach (var cover in series.Images) { var fileName = GetCoverPath(series.Id, cover.CoverType); - if (!_coverExistsSpecification.AlreadyExists(cover.Url, fileName)) + try { - DownloadCover(series, cover); + if (!_coverExistsSpecification.AlreadyExists(cover.Url, fileName)) + { + DownloadCover(series, cover); + } + } + catch (WebException e) + { + _logger.Warn(string.Format("Couldn't download media cover for {0}. {1}", series, e.Message); + } + catch (Exception e) + { + _logger.ErrorException("Couldn't download media cover for " + series, e); } } } private void DownloadCover(Series series, MediaCover cover) { - try - { - var fileName = GetCoverPath(series.Id, cover.CoverType); + var fileName = GetCoverPath(series.Id, cover.CoverType); + + _logger.Info("Downloading {0} for {1} {2}", cover.CoverType, series, cover.Url); + _httpProvider.DownloadFile(cover.Url, fileName); - _logger.Info("Downloading {0} for {1} {2}", cover.CoverType, series, cover.Url); - _httpProvider.DownloadFile(cover.Url, fileName); - } - catch (WebException e) - { - _logger.Warn("Couldn't download media cover for " + series); - } - catch (Exception e) - { - _logger.ErrorException("Couldn't download media cover for " + series, e); - } } public void HandleAsync(SeriesDeletedEvent message)