The great logger.Error cleanup!

This commit is contained in:
Keivan Beigi 2017-01-05 15:32:17 -08:00
parent e45d4f60a4
commit 73840dcacc
73 changed files with 201 additions and 208 deletions

View File

@ -68,7 +68,7 @@ namespace NzbDrone.Api.Indexers
} }
catch (ReleaseDownloadException ex) catch (ReleaseDownloadException ex)
{ {
_logger.Error(ex, ex.Message); _logger.Error(ex);
throw new NzbDroneClientException(HttpStatusCode.Conflict, "Getting release from indexer failed"); throw new NzbDroneClientException(HttpStatusCode.Conflict, "Getting release from indexer failed");
} }
@ -96,7 +96,7 @@ namespace NzbDrone.Api.Indexers
} }
catch (Exception ex) catch (Exception ex)
{ {
_logger.Error(ex, "Episode search failed: " + ex.Message); _logger.Error(ex, "Episode search failed");
} }
return new List<ReleaseResource>(); return new List<ReleaseResource>();

View File

@ -108,16 +108,16 @@ namespace NzbDrone.Common.Disk
switch (stringComparison) switch (stringComparison)
{ {
case StringComparison.CurrentCulture: case StringComparison.CurrentCulture:
case StringComparison.InvariantCulture: case StringComparison.InvariantCulture:
case StringComparison.Ordinal: case StringComparison.Ordinal:
{ {
return File.Exists(path) && path == path.GetActualCasing(); return File.Exists(path) && path == path.GetActualCasing();
} }
default: default:
{ {
return File.Exists(path); return File.Exists(path);
} }
} }
} }
@ -128,7 +128,7 @@ namespace NzbDrone.Common.Disk
try try
{ {
var testPath = Path.Combine(path, "sonarr_write_test.txt"); var testPath = Path.Combine(path, "sonarr_write_test.txt");
var testContent = string.Format("This file was created to verify if '{0}' is writable. It should've been automatically deleted. Feel free to delete it.", path); var testContent = $"This file was created to verify if '{path}' is writable. It should've been automatically deleted. Feel free to delete it.";
File.WriteAllText(testPath, testContent); File.WriteAllText(testPath, testContent);
File.Delete(testPath); File.Delete(testPath);
return true; return true;

View File

@ -352,7 +352,7 @@ namespace NzbDrone.Common.Disk
} }
catch (Exception ex) catch (Exception ex)
{ {
_logger.Error(ex, string.Format("Failed to properly rollback the file move [{0}] to [{1}], incomplete file may be left in target path.", sourcePath, targetPath)); _logger.Error(ex, "Failed to properly rollback the file move [{0}] to [{1}], incomplete file may be left in target path.", sourcePath, targetPath);
} }
} }
@ -368,7 +368,7 @@ namespace NzbDrone.Common.Disk
} }
catch (Exception ex) catch (Exception ex)
{ {
_logger.Error(ex, string.Format("Failed to properly rollback the file move [{0}] to [{1}], file may be left in target path.", sourcePath, targetPath)); _logger.Error(ex, "Failed to properly rollback the file move [{0}] to [{1}], file may be left in target path.", sourcePath, targetPath);
} }
} }
@ -387,7 +387,7 @@ namespace NzbDrone.Common.Disk
} }
catch (Exception ex) catch (Exception ex)
{ {
_logger.Error(ex, string.Format("Failed to properly rollback the file copy [{0}] to [{1}], file may be left in target path.", sourcePath, targetPath)); _logger.Error(ex, "Failed to properly rollback the file copy [{0}] to [{1}], file may be left in target path.", sourcePath, targetPath);
} }
} }
@ -429,7 +429,7 @@ namespace NzbDrone.Common.Disk
if (i == RetryCount) if (i == RetryCount)
{ {
_logger.Error("Failed to completely transfer [{0}] to [{1}], aborting.", sourcePath, targetPath, i + 1, RetryCount); _logger.Error("Failed to completely transfer [{0}] to [{1}], aborting.", sourcePath, targetPath);
} }
else else
{ {

View File

@ -90,7 +90,7 @@ namespace NzbDrone.Common.Http
response.StatusCode == HttpStatusCode.MovedPermanently || response.StatusCode == HttpStatusCode.MovedPermanently ||
response.StatusCode == HttpStatusCode.Found)) response.StatusCode == HttpStatusCode.Found))
{ {
_logger.Error("Server requested a redirect to [" + response.Headers["Location"] + "]. Update the request URL to avoid this redirect."); _logger.Error("Server requested a redirect to [{0}]. Update the request URL to avoid this redirect.", response.Headers["Location"]);
} }
if (!request.SuppressHttpError && response.HasHttpError) if (!request.SuppressHttpError && response.HasHttpError)

View File

@ -19,7 +19,7 @@ namespace NzbDrone.Common.Instrumentation
var exception = e.Exception; var exception = e.Exception;
Console.WriteLine("Task Error: {0}", exception); Console.WriteLine("Task Error: {0}", exception);
Logger.Error(exception, "Task Error: " + exception.Message); Logger.Error(exception, "Task Error");
} }
private static void HandleAppDomainException(object sender, UnhandledExceptionEventArgs e) private static void HandleAppDomainException(object sender, UnhandledExceptionEventArgs e)

View File

@ -125,7 +125,7 @@ namespace NzbDrone.Common.Instrumentation.Sentry
} }
catch (Exception e) catch (Exception e)
{ {
InternalLogger.Error("Unable to send Sentry request: {0}", e.Message); InternalLogger.Error(e, "Unable to send Sentry request");
} }
} }
} }

View File

@ -37,7 +37,7 @@ namespace NzbDrone.Common.Processes
} }
catch (Exception ex) catch (Exception ex)
{ {
_logger.Error(ex, "Unable to write PID file: " + filename); _logger.Error(ex, "Unable to write PID file {0}", filename);
throw; throw;
} }
} }

View File

@ -98,9 +98,9 @@ namespace NzbDrone.Common.Processes
var process = new Process var process = new Process
{ {
StartInfo = new ProcessStartInfo(url) StartInfo = new ProcessStartInfo(url)
{ {
UseShellExecute = true UseShellExecute = true
} }
}; };
process.Start(); process.Start();
@ -136,9 +136,9 @@ namespace NzbDrone.Common.Processes
logger.Debug("Starting {0} {1}", path, args); logger.Debug("Starting {0} {1}", path, args);
var process = new Process var process = new Process
{ {
StartInfo = startInfo StartInfo = startInfo
}; };
process.OutputDataReceived += (sender, eventArgs) => process.OutputDataReceived += (sender, eventArgs) =>
{ {

View File

@ -181,7 +181,7 @@ namespace NzbDrone.Core.DataAugmentation.Scene
} }
catch (Exception ex) catch (Exception ex)
{ {
_logger.Error(ex, "Failed to Update Scene Mappings:"); _logger.Error(ex, "Failed to Update Scene Mappings.");
} }
} }

View File

@ -83,7 +83,7 @@ namespace NzbDrone.Core.DataAugmentation.Xem
} }
catch (Exception ex) catch (Exception ex)
{ {
_logger.Error(ex, "Error updating scene numbering mappings for: " + series); _logger.Error(ex, "Error updating scene numbering mappings for {0}", series);
} }
} }

View File

@ -85,7 +85,7 @@ namespace NzbDrone.Core.Datastore
if (result.Count != idList.Count()) if (result.Count != idList.Count())
{ {
throw new ApplicationException("Expected query to return {0} rows but returned {1}".Inject(idList.Count(), result.Count)); throw new ApplicationException($"Expected query to return {idList.Count} rows but returned {result.Count}");
} }
return result; return result;

View File

@ -47,7 +47,7 @@ namespace NzbDrone.Core.Datastore.Migration.Framework
public void Error(Exception exception) public void Error(Exception exception)
{ {
_logger.Error(exception, exception.Message); _logger.Error(exception);
} }
public void Write(string message, bool escaped) public void Write(string message, bool escaped)

View File

@ -84,7 +84,7 @@ namespace NzbDrone.Core.DecisionEngine
} }
else if (remoteEpisode.Episodes.Empty()) else if (remoteEpisode.Episodes.Empty())
{ {
decision = new DownloadDecision(remoteEpisode, new Rejection("Unable to parse episodes from release name")); decision = new DownloadDecision(remoteEpisode, new Rejection("Unable to parse episodes from release name"));
} }
else else
{ {
@ -143,8 +143,8 @@ namespace NzbDrone.Core.DecisionEngine
{ {
e.Data.Add("report", remoteEpisode.Release.ToJson()); e.Data.Add("report", remoteEpisode.Release.ToJson());
e.Data.Add("parsed", remoteEpisode.ParsedEpisodeInfo.ToJson()); e.Data.Add("parsed", remoteEpisode.ParsedEpisodeInfo.ToJson());
_logger.Error(e, "Couldn't evaluate decision on " + remoteEpisode.Release.Title); _logger.Error(e, "Couldn't evaluate decision on {0}", remoteEpisode.Release.Title);
return new Rejection(string.Format("{0}: {1}", spec.GetType().Name, e.Message)); return new Rejection($"{spec.GetType().Name}: {e.Message}");
} }
return null; return null;

View File

@ -94,7 +94,7 @@ namespace NzbDrone.Core.Download.Clients.Deluge
} }
catch (DownloadClientException ex) catch (DownloadClientException ex)
{ {
_logger.Error(ex, ex.Message); _logger.Error(ex, "Couldn't get list of torrents");
return Enumerable.Empty<DownloadClientItem>(); return Enumerable.Empty<DownloadClientItem>();
} }
@ -198,12 +198,12 @@ namespace NzbDrone.Core.Download.Clients.Deluge
} }
catch (DownloadClientAuthenticationException ex) catch (DownloadClientAuthenticationException ex)
{ {
_logger.Error(ex, ex.Message); _logger.Error(ex);
return new NzbDroneValidationFailure("Password", "Authentication failed"); return new NzbDroneValidationFailure("Password", "Authentication failed");
} }
catch (WebException ex) catch (WebException ex)
{ {
_logger.Error(ex, ex.Message); _logger.Error(ex);
switch (ex.Status) switch (ex.Status)
{ {
case WebExceptionStatus.ConnectFailure: case WebExceptionStatus.ConnectFailure:
@ -227,7 +227,7 @@ namespace NzbDrone.Core.Download.Clients.Deluge
} }
catch (Exception ex) catch (Exception ex)
{ {
_logger.Error(ex, ex.Message); _logger.Error(ex);
return new NzbDroneValidationFailure(string.Empty, "Unknown exception: " + ex.Message); return new NzbDroneValidationFailure(string.Empty, "Unknown exception: " + ex.Message);
} }
@ -278,7 +278,7 @@ namespace NzbDrone.Core.Download.Clients.Deluge
} }
catch (Exception ex) catch (Exception ex)
{ {
_logger.Error(ex, ex.Message); _logger.Error(ex);
return new NzbDroneValidationFailure(string.Empty, "Failed to get the list of torrents: " + ex.Message); return new NzbDroneValidationFailure(string.Empty, "Failed to get the list of torrents: " + ex.Message);
} }

View File

@ -166,7 +166,7 @@ namespace NzbDrone.Core.Download.Clients.NzbVortex
} }
catch (Exception ex) catch (Exception ex)
{ {
_logger.Error(ex, ex.Message); _logger.Error(ex);
return new ValidationFailure("Host", "Unable to connect to NZBVortex"); return new ValidationFailure("Host", "Unable to connect to NZBVortex");
} }
@ -187,7 +187,7 @@ namespace NzbDrone.Core.Download.Clients.NzbVortex
} }
catch (Exception ex) catch (Exception ex)
{ {
_logger.Error(ex, ex.Message); _logger.Error(ex);
return new ValidationFailure("Host", "Unable to connect to NZBVortex"); return new ValidationFailure("Host", "Unable to connect to NZBVortex");
} }

View File

@ -56,7 +56,7 @@ namespace NzbDrone.Core.Download.Clients.Nzbget
} }
catch (DownloadClientException ex) catch (DownloadClientException ex)
{ {
_logger.Error(ex, ex.Message); _logger.Error(ex);
return Enumerable.Empty<DownloadClientItem>(); return Enumerable.Empty<DownloadClientItem>();
} }
@ -120,7 +120,7 @@ namespace NzbDrone.Core.Download.Clients.Nzbget
} }
catch (DownloadClientException ex) catch (DownloadClientException ex)
{ {
_logger.Error(ex, ex.Message); _logger.Error(ex);
return Enumerable.Empty<DownloadClientItem>(); return Enumerable.Empty<DownloadClientItem>();
} }
@ -286,7 +286,7 @@ namespace NzbDrone.Core.Download.Clients.Nzbget
{ {
return new ValidationFailure("Username", "Authentication failed"); return new ValidationFailure("Username", "Authentication failed");
} }
_logger.Error(ex, ex.Message); _logger.Error(ex);
return new ValidationFailure("Host", "Unable to connect to NZBGet"); return new ValidationFailure("Host", "Unable to connect to NZBGet");
} }

View File

@ -85,7 +85,7 @@ namespace NzbDrone.Core.Download.Clients.QBittorrent
} }
catch (DownloadClientException ex) catch (DownloadClientException ex)
{ {
_logger.Error(ex, ex.Message); _logger.Error(ex);
return Enumerable.Empty<DownloadClientItem>(); return Enumerable.Empty<DownloadClientItem>();
} }
@ -226,7 +226,7 @@ namespace NzbDrone.Core.Download.Clients.QBittorrent
} }
catch (DownloadClientAuthenticationException ex) catch (DownloadClientAuthenticationException ex)
{ {
_logger.Error(ex, ex.Message); _logger.Error(ex);
return new NzbDroneValidationFailure("Username", "Authentication failure") return new NzbDroneValidationFailure("Username", "Authentication failure")
{ {
DetailedDescription = "Please verify your username and password." DetailedDescription = "Please verify your username and password."
@ -234,7 +234,7 @@ namespace NzbDrone.Core.Download.Clients.QBittorrent
} }
catch (WebException ex) catch (WebException ex)
{ {
_logger.Error(ex, ex.Message); _logger.Error(ex);
if (ex.Status == WebExceptionStatus.ConnectFailure) if (ex.Status == WebExceptionStatus.ConnectFailure)
{ {
return new NzbDroneValidationFailure("Host", "Unable to connect") return new NzbDroneValidationFailure("Host", "Unable to connect")
@ -246,7 +246,7 @@ namespace NzbDrone.Core.Download.Clients.QBittorrent
} }
catch (Exception ex) catch (Exception ex)
{ {
_logger.Error(ex, ex.Message); _logger.Error(ex);
return new NzbDroneValidationFailure(String.Empty, "Unknown exception: " + ex.Message); return new NzbDroneValidationFailure(String.Empty, "Unknown exception: " + ex.Message);
} }
@ -261,7 +261,7 @@ namespace NzbDrone.Core.Download.Clients.QBittorrent
} }
catch (Exception ex) catch (Exception ex)
{ {
_logger.Error(ex, ex.Message); _logger.Error(ex);
return new NzbDroneValidationFailure(String.Empty, "Failed to get the list of torrents: " + ex.Message); return new NzbDroneValidationFailure(String.Empty, "Failed to get the list of torrents: " + ex.Message);
} }

View File

@ -118,7 +118,7 @@ namespace NzbDrone.Core.Download.Clients.Sabnzbd
} }
catch (DownloadClientException ex) catch (DownloadClientException ex)
{ {
_logger.Error(ex, ex.Message); _logger.Error(ex);
return Enumerable.Empty<DownloadClientItem>(); return Enumerable.Empty<DownloadClientItem>();
} }
@ -381,7 +381,7 @@ namespace NzbDrone.Core.Download.Clients.Sabnzbd
} }
catch (Exception ex) catch (Exception ex)
{ {
_logger.Error(ex, ex.Message); _logger.Error(ex);
return new ValidationFailure("Host", "Unable to connect to SABnzbd"); return new ValidationFailure("Host", "Unable to connect to SABnzbd");
} }
} }

View File

@ -41,7 +41,7 @@ namespace NzbDrone.Core.Download.Clients.Transmission
} }
catch (DownloadClientException ex) catch (DownloadClientException ex)
{ {
_logger.Error(ex, ex.Message); _logger.Error(ex);
return Enumerable.Empty<DownloadClientItem>(); return Enumerable.Empty<DownloadClientItem>();
} }
@ -204,7 +204,7 @@ namespace NzbDrone.Core.Download.Clients.Transmission
} }
catch (DownloadClientAuthenticationException ex) catch (DownloadClientAuthenticationException ex)
{ {
_logger.Error(ex, ex.Message); _logger.Error(ex);
return new NzbDroneValidationFailure("Username", "Authentication failure") return new NzbDroneValidationFailure("Username", "Authentication failure")
{ {
DetailedDescription = string.Format("Please verify your username and password. Also verify if the host running Sonarr isn't blocked from accessing {0} by WhiteList limitations in the {0} configuration.", Name) DetailedDescription = string.Format("Please verify your username and password. Also verify if the host running Sonarr isn't blocked from accessing {0} by WhiteList limitations in the {0} configuration.", Name)
@ -212,7 +212,7 @@ namespace NzbDrone.Core.Download.Clients.Transmission
} }
catch (WebException ex) catch (WebException ex)
{ {
_logger.Error(ex, ex.Message); _logger.Error(ex);
if (ex.Status == WebExceptionStatus.ConnectFailure) if (ex.Status == WebExceptionStatus.ConnectFailure)
{ {
return new NzbDroneValidationFailure("Host", "Unable to connect") return new NzbDroneValidationFailure("Host", "Unable to connect")
@ -224,7 +224,7 @@ namespace NzbDrone.Core.Download.Clients.Transmission
} }
catch (Exception ex) catch (Exception ex)
{ {
_logger.Error(ex, ex.Message); _logger.Error(ex);
return new NzbDroneValidationFailure(string.Empty, "Unknown exception: " + ex.Message); return new NzbDroneValidationFailure(string.Empty, "Unknown exception: " + ex.Message);
} }
} }
@ -239,7 +239,7 @@ namespace NzbDrone.Core.Download.Clients.Transmission
} }
catch (Exception ex) catch (Exception ex)
{ {
_logger.Error(ex, ex.Message); _logger.Error(ex);
return new NzbDroneValidationFailure(string.Empty, "Failed to get the list of torrents: " + ex.Message); return new NzbDroneValidationFailure(string.Empty, "Failed to get the list of torrents: " + ex.Message);
} }

View File

@ -147,7 +147,7 @@ namespace NzbDrone.Core.Download.Clients.RTorrent
} }
catch (DownloadClientException ex) catch (DownloadClientException ex)
{ {
_logger.Error(ex, ex.Message); _logger.Error(ex);
return Enumerable.Empty<DownloadClientItem>(); return Enumerable.Empty<DownloadClientItem>();
} }
@ -196,7 +196,7 @@ namespace NzbDrone.Core.Download.Clients.RTorrent
} }
catch (Exception ex) catch (Exception ex)
{ {
_logger.Error(ex, ex.Message); _logger.Error(ex);
return new NzbDroneValidationFailure(string.Empty, "Unknown exception: " + ex.Message); return new NzbDroneValidationFailure(string.Empty, "Unknown exception: " + ex.Message);
} }
@ -211,7 +211,7 @@ namespace NzbDrone.Core.Download.Clients.RTorrent
} }
catch (Exception ex) catch (Exception ex)
{ {
_logger.Error(ex, ex.Message); _logger.Error(ex);
return new NzbDroneValidationFailure(string.Empty, "Failed to get the list of torrents: " + ex.Message); return new NzbDroneValidationFailure(string.Empty, "Failed to get the list of torrents: " + ex.Message);
} }

View File

@ -105,7 +105,7 @@ namespace NzbDrone.Core.Download.Clients.UTorrent
} }
catch (DownloadClientException ex) catch (DownloadClientException ex)
{ {
_logger.Error(ex, ex.Message); _logger.Error(ex);
return Enumerable.Empty<DownloadClientItem>(); return Enumerable.Empty<DownloadClientItem>();
} }
@ -232,7 +232,7 @@ namespace NzbDrone.Core.Download.Clients.UTorrent
} }
catch (DownloadClientAuthenticationException ex) catch (DownloadClientAuthenticationException ex)
{ {
_logger.Error(ex, ex.Message); _logger.Error(ex);
return new NzbDroneValidationFailure("Username", "Authentication failure") return new NzbDroneValidationFailure("Username", "Authentication failure")
{ {
DetailedDescription = "Please verify your username and password." DetailedDescription = "Please verify your username and password."
@ -240,7 +240,7 @@ namespace NzbDrone.Core.Download.Clients.UTorrent
} }
catch (WebException ex) catch (WebException ex)
{ {
_logger.Error(ex, ex.Message); _logger.Error(ex);
if (ex.Status == WebExceptionStatus.ConnectFailure) if (ex.Status == WebExceptionStatus.ConnectFailure)
{ {
return new NzbDroneValidationFailure("Host", "Unable to connect") return new NzbDroneValidationFailure("Host", "Unable to connect")
@ -252,7 +252,7 @@ namespace NzbDrone.Core.Download.Clients.UTorrent
} }
catch (Exception ex) catch (Exception ex)
{ {
_logger.Error(ex, ex.Message); _logger.Error(ex);
return new NzbDroneValidationFailure(string.Empty, "Unknown exception: " + ex.Message); return new NzbDroneValidationFailure(string.Empty, "Unknown exception: " + ex.Message);
} }
@ -267,7 +267,7 @@ namespace NzbDrone.Core.Download.Clients.UTorrent
} }
catch (Exception ex) catch (Exception ex)
{ {
_logger.Error(ex, ex.Message); _logger.Error(ex);
return new NzbDroneValidationFailure(string.Empty, "Failed to get the list of torrents: " + ex.Message); return new NzbDroneValidationFailure(string.Empty, "Failed to get the list of torrents: " + ex.Message);
} }

View File

@ -74,7 +74,7 @@ namespace NzbDrone.Core.Download
} }
catch (Exception e) catch (Exception e)
{ {
_logger.Error(e, "Couldn't remove item from client " + trackedDownload.DownloadItem.Title); _logger.Error(e, "Couldn't remove item from client {0}", trackedDownload.DownloadItem.Title);
} }
} }
} }

View File

@ -135,7 +135,7 @@ namespace NzbDrone.Core.Download.TrackedDownloads
} }
catch (Exception e) catch (Exception e)
{ {
_logger.Error(e, "Couldn't process tracked download " + downloadItem.Title); _logger.Error(e, "Couldn't process tracked download {0}", downloadItem.Title);
} }
return trackedDownloads; return trackedDownloads;

View File

@ -58,11 +58,11 @@ namespace NzbDrone.Core.Extras.Metadata.Consumers.Xbmc
if (filename == null) return null; if (filename == null) return null;
var metadata = new MetadataFile var metadata = new MetadataFile
{ {
SeriesId = series.Id, SeriesId = series.Id,
Consumer = GetType().Name, Consumer = GetType().Name,
RelativePath = series.Path.GetRelativePath(path) RelativePath = series.Path.GetRelativePath(path)
}; };
if (SeriesImagesRegex.IsMatch(filename)) if (SeriesImagesRegex.IsMatch(filename))
{ {
@ -93,7 +93,7 @@ namespace NzbDrone.Core.Extras.Metadata.Consumers.Xbmc
{ {
return null; return null;
} }
return metadata; return metadata;
} }
@ -245,7 +245,7 @@ namespace NzbDrone.Core.Extras.Metadata.Consumers.Xbmc
var streamDetails = new XElement("streamdetails"); var streamDetails = new XElement("streamdetails");
var video = new XElement("video"); var video = new XElement("video");
video.Add(new XElement("aspect", (float) episodeFile.MediaInfo.Width / (float) episodeFile.MediaInfo.Height)); video.Add(new XElement("aspect", (float)episodeFile.MediaInfo.Width / (float)episodeFile.MediaInfo.Height));
video.Add(new XElement("bitrate", episodeFile.MediaInfo.VideoBitrate)); video.Add(new XElement("bitrate", episodeFile.MediaInfo.VideoBitrate));
video.Add(new XElement("codec", episodeFile.MediaInfo.VideoCodec)); video.Add(new XElement("codec", episodeFile.MediaInfo.VideoCodec));
video.Add(new XElement("framerate", episodeFile.MediaInfo.VideoFps)); video.Add(new XElement("framerate", episodeFile.MediaInfo.VideoFps));
@ -338,8 +338,8 @@ namespace NzbDrone.Core.Extras.Metadata.Consumers.Xbmc
} }
catch (Exception ex) catch (Exception ex)
{ {
_logger.Error(ex, "Unable to process episode image for file: " + Path.Combine(series.Path, episodeFile.RelativePath)); _logger.Error(ex, "Unable to process episode image for file: {0}", Path.Combine(series.Path, episodeFile.RelativePath));
return new List<ImageFileResult>(); return new List<ImageFileResult>();
} }
} }

View File

@ -33,10 +33,11 @@ namespace NzbDrone.Core.HealthCheck.Checks
} }
catch (Exception ex) catch (Exception ex)
{ {
var message = String.Format("Unable to communicate with {0}.", downloadClient.Definition.Name);
_logger.Error(ex, message); _logger.Error(ex, "Unable to communicate with {0}", downloadClient.Definition.Name);
return new HealthCheck(GetType(), HealthCheckResult.Error, message + " " + ex.Message);
var message = $"Unable to communicate with {downloadClient.Definition.Name}.";
return new HealthCheck(GetType(), HealthCheckResult.Error, $"{message} {ex.Message}");
} }
} }

View File

@ -15,7 +15,7 @@ namespace NzbDrone.Core.HealthCheck.Checks
} }
catch (Exception e) catch (Exception e)
{ {
return new HealthCheck(GetType(), HealthCheckResult.Warning, "MediaInfo could not be loaded " + e.Message); return new HealthCheck(GetType(), HealthCheckResult.Warning, $"MediaInfo Library could not be loaded {e.Message}");
} }
return new HealthCheck(GetType()); return new HealthCheck(GetType());

View File

@ -30,7 +30,7 @@ namespace NzbDrone.Core.HealthCheck.Checks
if (_configService.ProxyEnabled) if (_configService.ProxyEnabled)
{ {
var addresses = Dns.GetHostAddresses(_configService.ProxyHostname); var addresses = Dns.GetHostAddresses(_configService.ProxyHostname);
if(!addresses.Any()) if (!addresses.Any())
{ {
return new HealthCheck(GetType(), HealthCheckResult.Error, string.Format("Failed to resolve the IP Address for the Configured Proxy Host {0}", _configService.ProxyHostname)); return new HealthCheck(GetType(), HealthCheckResult.Error, string.Format("Failed to resolve the IP Address for the Configured Proxy Host {0}", _configService.ProxyHostname));
} }
@ -47,13 +47,13 @@ namespace NzbDrone.Core.HealthCheck.Checks
if (response.StatusCode == HttpStatusCode.BadRequest) if (response.StatusCode == HttpStatusCode.BadRequest)
{ {
_logger.Error("Proxy Health Check failed: {0}", response.StatusCode); _logger.Error("Proxy Health Check failed: {0}", response.StatusCode);
return new HealthCheck(GetType(), HealthCheckResult.Error, string.Format("Failed to test proxy: StatusCode {1}", request.Url, response.StatusCode)); return new HealthCheck(GetType(), HealthCheckResult.Error, $"Failed to test proxy. StatusCode: {response.StatusCode}");
} }
} }
catch (Exception ex) catch (Exception ex)
{ {
_logger.Error(ex, "Proxy Health Check failed: {0}", ex.Message); _logger.Error(ex, "Proxy Health Check failed");
return new HealthCheck(GetType(), HealthCheckResult.Error, string.Format("Failed to test proxy: {1}", request.Url, ex.Message)); return new HealthCheck(GetType(), HealthCheckResult.Error, $"Failed to test proxy: {request.Url}");
} }
} }

View File

@ -54,7 +54,7 @@ namespace NzbDrone.Core.Housekeeping.Housekeepers
} }
catch (Exception e) catch (Exception e)
{ {
_logger.Error(e, "Couldn't validate image " + image.RelativePath); _logger.Error(e, "Couldn't validate image {0}", image.RelativePath);
} }
} }
} }

View File

@ -34,7 +34,7 @@ namespace NzbDrone.Core.Housekeeping
} }
catch (Exception ex) catch (Exception ex)
{ {
_logger.Error(ex, "Error running housekeeping task: " + housekeeper.GetType().Name); _logger.Error(ex, "Error running housekeeping task: {0}", housekeeper.GetType().Name);
} }
} }

View File

@ -53,8 +53,7 @@ namespace NzbDrone.Core.IndexerSearch
} }
catch (Exception ex) catch (Exception ex)
{ {
var message = String.Format("Unable to search for missing episodes in season {0} of [{1}]", season.Key, series.Key); _logger.Error(ex, "Unable to search for missing episodes in season {0} of [{1}]", season.Key, series.Key);
_logger.Error(ex, message);
continue; continue;
} }
} }
@ -67,8 +66,7 @@ namespace NzbDrone.Core.IndexerSearch
} }
catch (Exception ex) catch (Exception ex)
{ {
var message = String.Format("Unable to search for missing episode: [{0}]", season.First()); _logger.Error(ex, "Unable to search for missing episode: [{0}]", season.First());
_logger.Error(ex, message);
continue; continue;
} }
} }

View File

@ -120,7 +120,7 @@ namespace NzbDrone.Core.IndexerSearch
{ {
var episode = sceneSeasonEpisodes.First(); var episode = sceneSeasonEpisodes.First();
var searchSpec = Get<SingleEpisodeSearchCriteria>(series, sceneSeasonEpisodes.ToList(), userInvokedSearch); var searchSpec = Get<SingleEpisodeSearchCriteria>(series, sceneSeasonEpisodes.ToList(), userInvokedSearch);
searchSpec.SeasonNumber = sceneSeasonEpisodes.Key; searchSpec.SeasonNumber = sceneSeasonEpisodes.Key;
searchSpec.MonitoredEpisodesOnly = true; searchSpec.MonitoredEpisodesOnly = true;
@ -160,7 +160,7 @@ namespace NzbDrone.Core.IndexerSearch
private List<DownloadDecision> SearchSingle(Series series, Episode episode, bool userInvokedSearch) private List<DownloadDecision> SearchSingle(Series series, Episode episode, bool userInvokedSearch)
{ {
var searchSpec = Get<SingleEpisodeSearchCriteria>(series, new List<Episode>{episode}, userInvokedSearch); var searchSpec = Get<SingleEpisodeSearchCriteria>(series, new List<Episode> { episode }, userInvokedSearch);
if (series.UseSceneNumbering && episode.SceneSeasonNumber.HasValue && episode.SceneEpisodeNumber.HasValue) if (series.UseSceneNumbering && episode.SceneSeasonNumber.HasValue && episode.SceneEpisodeNumber.HasValue)
{ {
@ -179,7 +179,7 @@ namespace NzbDrone.Core.IndexerSearch
private List<DownloadDecision> SearchDaily(Series series, Episode episode, bool userInvokedSearch) private List<DownloadDecision> SearchDaily(Series series, Episode episode, bool userInvokedSearch)
{ {
var airDate = DateTime.ParseExact(episode.AirDate, Episode.AIR_DATE_FORMAT, CultureInfo.InvariantCulture); var airDate = DateTime.ParseExact(episode.AirDate, Episode.AIR_DATE_FORMAT, CultureInfo.InvariantCulture);
var searchSpec = Get<DailyEpisodeSearchCriteria>(series, new List<Episode>{ episode }, userInvokedSearch); var searchSpec = Get<DailyEpisodeSearchCriteria>(series, new List<Episode> { episode }, userInvokedSearch);
searchSpec.AirDate = airDate; searchSpec.AirDate = airDate;
return Dispatch(indexer => indexer.Fetch(searchSpec), searchSpec); return Dispatch(indexer => indexer.Fetch(searchSpec), searchSpec);
@ -272,7 +272,7 @@ namespace NzbDrone.Core.IndexerSearch
} }
catch (Exception e) catch (Exception e)
{ {
_logger.Error(e, "Error while searching for " + criteriaBase); _logger.Error(e, "Error while searching for {0}", criteriaBase);
} }
}).LogExceptions()); }).LogExceptions());
} }

View File

@ -260,14 +260,13 @@ namespace NzbDrone.Core.Indexers
catch (IndexerException ex) catch (IndexerException ex)
{ {
_indexerStatusService.RecordFailure(Definition.Id); _indexerStatusService.RecordFailure(Definition.Id);
var message = string.Format("{0} - {1}", ex.Message, url); _logger.Warn(ex, "{0}", url);
_logger.Warn(ex, message);
} }
catch (Exception feedEx) catch (Exception feedEx)
{ {
_indexerStatusService.RecordFailure(Definition.Id); _indexerStatusService.RecordFailure(Definition.Id);
feedEx.Data.Add("FeedUrl", url); feedEx.Data.Add("FeedUrl", url);
_logger.Error(feedEx, "An error occurred while processing feed. " + url); _logger.Error(feedEx, "An error occurred while processing feed. {0}", url);
} }
return CleanupReleases(releases); return CleanupReleases(releases);

View File

@ -66,7 +66,7 @@ namespace NzbDrone.Core.Indexers
catch (Exception itemEx) catch (Exception itemEx)
{ {
itemEx.Data.Add("Item", item.Title()); itemEx.Data.Add("Item", item.Title());
_logger.Error(itemEx, "An error occurred while processing feed item from " + indexerResponse.Request.Url); _logger.Error(itemEx, "An error occurred while processing feed item from {0}", indexerResponse.Request.Url);
} }
} }

View File

@ -97,7 +97,7 @@ namespace NzbDrone.Core.Instrumentation
} }
catch (SQLiteException ex) catch (SQLiteException ex)
{ {
InternalLogger.Error("Unable to save log event to database: {0}", ex); InternalLogger.Error(ex, "Unable to save log event to database");
throw; throw;
} }
} }

View File

@ -99,11 +99,11 @@ namespace NzbDrone.Core.MediaCover
} }
catch (WebException e) catch (WebException e)
{ {
_logger.Warn(string.Format("Couldn't download media cover for {0}. {1}", series, e.Message)); _logger.Warn("Couldn't download media cover for {0}. {1}", series, e.Message);
} }
catch (Exception e) catch (Exception e)
{ {
_logger.Error(e, "Couldn't download media cover for " + series); _logger.Error(e, "Couldn't download media cover for {0}", series);
} }
EnsureResizedCovers(series, cover, !alreadyExists); EnsureResizedCovers(series, cover, !alreadyExists);

View File

@ -64,7 +64,7 @@ namespace NzbDrone.Core.MediaFiles
EnsureEpisodeFolder(episodeFile, series, episodes.Select(v => v.SeasonNumber).First(), filePath); EnsureEpisodeFolder(episodeFile, series, episodes.Select(v => v.SeasonNumber).First(), filePath);
_logger.Debug("Renaming episode file: {0} to {1}", episodeFile, filePath); _logger.Debug("Renaming episode file: {0} to {1}", episodeFile, filePath);
return TransferFile(episodeFile, series, episodes, filePath, TransferMode.Move); return TransferFile(episodeFile, series, episodes, filePath, TransferMode.Move);
} }
@ -76,7 +76,7 @@ namespace NzbDrone.Core.MediaFiles
EnsureEpisodeFolder(episodeFile, localEpisode, filePath); EnsureEpisodeFolder(episodeFile, localEpisode, filePath);
_logger.Debug("Moving episode file: {0} to {1}", episodeFile.Path, filePath); _logger.Debug("Moving episode file: {0} to {1}", episodeFile.Path, filePath);
return TransferFile(episodeFile, localEpisode.Series, localEpisode.Episodes, filePath, TransferMode.Move); return TransferFile(episodeFile, localEpisode.Series, localEpisode.Episodes, filePath, TransferMode.Move);
} }
@ -96,11 +96,11 @@ namespace NzbDrone.Core.MediaFiles
_logger.Debug("Copying episode file: {0} to {1}", episodeFile.Path, filePath); _logger.Debug("Copying episode file: {0} to {1}", episodeFile.Path, filePath);
return TransferFile(episodeFile, localEpisode.Series, localEpisode.Episodes, filePath, TransferMode.Copy); return TransferFile(episodeFile, localEpisode.Series, localEpisode.Episodes, filePath, TransferMode.Copy);
} }
private EpisodeFile TransferFile(EpisodeFile episodeFile, Series series, List<Episode> episodes, string destinationFilePath, TransferMode mode) private EpisodeFile TransferFile(EpisodeFile episodeFile, Series series, List<Episode> episodes, string destinationFilePath, TransferMode mode)
{ {
Ensure.That(episodeFile, () => episodeFile).IsNotNull(); Ensure.That(episodeFile, () => episodeFile).IsNotNull();
Ensure.That(series,() => series).IsNotNull(); Ensure.That(series, () => series).IsNotNull();
Ensure.That(destinationFilePath, () => destinationFilePath).IsValidPath(); Ensure.That(destinationFilePath, () => destinationFilePath).IsValidPath();
var episodeFilePath = episodeFile.Path ?? Path.Combine(series.Path, episodeFile.RelativePath); var episodeFilePath = episodeFile.Path ?? Path.Combine(series.Path, episodeFile.RelativePath);
@ -206,7 +206,7 @@ namespace NzbDrone.Core.MediaFiles
} }
catch (IOException ex) catch (IOException ex)
{ {
_logger.Error(ex, "Unable to create directory: " + directoryName); _logger.Error(ex, "Unable to create directory: {0}", directoryName);
} }
_mediaFileAttributeService.SetFolderPermissions(directoryName); _mediaFileAttributeService.SetFolderPermissions(directoryName);

View File

@ -81,7 +81,6 @@ namespace NzbDrone.Core.MediaFiles.EpisodeImport
private bool CheckSize(long size, QualityModel quality) private bool CheckSize(long size, QualityModel quality)
{ {
if (_largeSampleSizeQualities.Contains(quality.Quality))
{ {
if (size < SampleSizeLimit * 2) if (size < SampleSizeLimit * 2)
{ {

View File

@ -111,7 +111,7 @@ namespace NzbDrone.Core.MediaFiles.EpisodeImport
} }
catch (Exception e) catch (Exception e)
{ {
_logger.Error(e, "Couldn't import file. " + file); _logger.Error(e, "Couldn't import file. {0}", file);
var localEpisode = new LocalEpisode { Path = file }; var localEpisode = new LocalEpisode { Path = file };
decision = new ImportDecision(localEpisode, new Rejection("Unexpected error processing file")); decision = new ImportDecision(localEpisode, new Rejection("Unexpected error processing file"));
@ -143,8 +143,8 @@ namespace NzbDrone.Core.MediaFiles.EpisodeImport
{ {
//e.Data.Add("report", remoteEpisode.Report.ToJson()); //e.Data.Add("report", remoteEpisode.Report.ToJson());
//e.Data.Add("parsed", remoteEpisode.ParsedEpisodeInfo.ToJson()); //e.Data.Add("parsed", remoteEpisode.ParsedEpisodeInfo.ToJson());
_logger.Error(e, "Couldn't evaluate decision on " + localEpisode.Path); _logger.Error(e, "Couldn't evaluate decision on {0}", localEpisode.Path);
return new Rejection(string.Format("{0}: {1}", spec.GetType().Name, e.Message)); return new Rejection($"{spec.GetType().Name}: {e.Message}");
} }
return null; return null;

View File

@ -14,7 +14,7 @@ namespace NzbDrone.Core.MediaFiles.EpisodeImport.Specifications
private readonly IConfigService _configService; private readonly IConfigService _configService;
private readonly Logger _logger; private readonly Logger _logger;
public FreeSpaceSpecification(IDiskProvider diskProvider, IConfigService configService, Logger logger) public FreeSpaceSpecification(IDiskProvider diskProvider, IConfigService configService, Logger logger)
{ {
_diskProvider = diskProvider; _diskProvider = diskProvider;
_configService = configService; _configService = configService;
@ -54,11 +54,11 @@ namespace NzbDrone.Core.MediaFiles.EpisodeImport.Specifications
} }
catch (DirectoryNotFoundException ex) catch (DirectoryNotFoundException ex)
{ {
_logger.Error("Unable to check free disk space while importing. " + ex.Message); _logger.Error(ex, "Unable to check free disk space while importing.");
} }
catch (Exception ex) catch (Exception ex)
{ {
_logger.Error(ex, "Unable to check free disk space while importing: " + localEpisode.Path); _logger.Error(ex, "Unable to check free disk space while importing. {0}", localEpisode.Path);
} }
return Decision.Accept(); return Decision.Accept();

View File

@ -42,12 +42,12 @@ namespace NzbDrone.Core.MediaFiles
{ {
if (ex is UnauthorizedAccessException || ex is InvalidOperationException || ex is FileNotFoundException) if (ex is UnauthorizedAccessException || ex is InvalidOperationException || ex is FileNotFoundException)
{ {
_logger.Debug("Unable to apply folder permissions to: ", path); _logger.Debug("Unable to apply folder permissions to {0}", path);
_logger.Debug(ex, ex.Message); _logger.Debug(ex, ex.Message);
} }
else else
{ {
_logger.Warn("Unable to apply folder permissions to: ", path); _logger.Warn("Unable to apply folder permissions to: {0}", path);
_logger.Warn(ex, ex.Message); _logger.Warn(ex, ex.Message);
} }
} }

View File

@ -68,8 +68,7 @@ namespace NzbDrone.Core.MediaFiles
catch (Exception ex) catch (Exception ex)
{ {
var errorMessage = string.Format("Unable to cleanup EpisodeFile in DB: {0}", episodeFile.Id); _logger.Error(ex, "Unable to cleanup EpisodeFile in DB: {0}", episodeFile.Id);
_logger.Error(ex, errorMessage);
} }
} }

View File

@ -113,7 +113,7 @@ namespace NzbDrone.Core.MediaFiles.MediaInfo
int.TryParse(aBitRate, out audioBitRate); int.TryParse(aBitRate, out audioBitRate);
int.TryParse(mediaInfo.Get(StreamKind.Audio, 0, "StreamCount"), out streamCount); int.TryParse(mediaInfo.Get(StreamKind.Audio, 0, "StreamCount"), out streamCount);
string audioChannelsStr = mediaInfo.Get(StreamKind.Audio, 0, "Channel(s)"); string audioChannelsStr = mediaInfo.Get(StreamKind.Audio, 0, "Channel(s)");
int aCindex = audioChannelsStr.IndexOf(" /", StringComparison.InvariantCultureIgnoreCase); int aCindex = audioChannelsStr.IndexOf(" /", StringComparison.InvariantCultureIgnoreCase);
@ -138,25 +138,25 @@ namespace NzbDrone.Core.MediaFiles.MediaInfo
int.TryParse(audioChannelsStr, out audioChannels); int.TryParse(audioChannelsStr, out audioChannels);
var mediaInfoModel = new MediaInfoModel var mediaInfoModel = new MediaInfoModel
{ {
VideoCodec = mediaInfo.Get(StreamKind.Video, 0, "Codec/String"), VideoCodec = mediaInfo.Get(StreamKind.Video, 0, "Codec/String"),
VideoBitrate = videoBitRate, VideoBitrate = videoBitRate,
VideoBitDepth = videoBitDepth, VideoBitDepth = videoBitDepth,
Height = height, Height = height,
Width = width, Width = width,
AudioFormat = mediaInfo.Get(StreamKind.Audio, 0, "Format"), AudioFormat = mediaInfo.Get(StreamKind.Audio, 0, "Format"),
AudioBitrate = audioBitRate, AudioBitrate = audioBitRate,
RunTime = GetBestRuntime(audioRuntime, videoRuntime, generalRuntime), RunTime = GetBestRuntime(audioRuntime, videoRuntime, generalRuntime),
AudioStreamCount = streamCount, AudioStreamCount = streamCount,
AudioChannels = audioChannels, AudioChannels = audioChannels,
AudioChannelPositions = audioChannelPositions, AudioChannelPositions = audioChannelPositions,
AudioChannelPositionsText = audioChannelPositionsText, AudioChannelPositionsText = audioChannelPositionsText,
AudioProfile = audioProfile.Trim(), AudioProfile = audioProfile.Trim(),
VideoFps = videoFrameRate, VideoFps = videoFrameRate,
AudioLanguages = audioLanguages, AudioLanguages = audioLanguages,
Subtitles = subtitles, Subtitles = subtitles,
ScanType = scanType ScanType = scanType
}; };
return mediaInfoModel; return mediaInfoModel;
} }
@ -171,14 +171,11 @@ namespace NzbDrone.Core.MediaFiles.MediaInfo
} }
catch (Exception ex) catch (Exception ex)
{ {
_logger.Error(ex, "Unable to parse media info from file: " + filename); _logger.Error(ex, "Unable to parse media info from file: {0}", filename);
} }
finally finally
{ {
if (mediaInfo != null) mediaInfo?.Close();
{
mediaInfo.Close();
}
} }
return null; return null;

View File

@ -117,8 +117,7 @@ namespace NzbDrone.Core.MediaFiles
} }
catch (IOException e) catch (IOException e)
{ {
var message = string.Format("Unable to move '{0}' to the recycling bin: '{1}'", path, destination); _logger.Error(e, "Unable to move '{0}' to the recycling bin: '{1}'", path, destination);
_logger.Error(e, message);
throw; throw;
} }

View File

@ -96,14 +96,14 @@ namespace NzbDrone.Core.MediaFiles
if (!episodeFilePath.PathEquals(newPath, StringComparison.Ordinal)) if (!episodeFilePath.PathEquals(newPath, StringComparison.Ordinal))
{ {
yield return new RenameEpisodeFilePreview yield return new RenameEpisodeFilePreview
{ {
SeriesId = series.Id, SeriesId = series.Id,
SeasonNumber = seasonNumber, SeasonNumber = seasonNumber,
EpisodeNumbers = episodesInFile.Select(e => e.EpisodeNumber).ToList(), EpisodeNumbers = episodesInFile.Select(e => e.EpisodeNumber).ToList(),
EpisodeFileId = file.Id, EpisodeFileId = file.Id,
ExistingPath = file.RelativePath, ExistingPath = file.RelativePath,
NewPath = series.Path.GetRelativePath(newPath) NewPath = series.Path.GetRelativePath(newPath)
}; };
} }
} }
} }
@ -132,7 +132,7 @@ namespace NzbDrone.Core.MediaFiles
} }
catch (Exception ex) catch (Exception ex)
{ {
_logger.Error(ex, "Failed to rename file: " + episodeFilePath); _logger.Error(ex, "Failed to rename file {0}", episodeFilePath);
} }
} }

View File

@ -38,22 +38,22 @@ namespace NzbDrone.Core.Messaging.Commands
{ {
try try
{ {
ExecuteCommand((dynamic) command.Body, command); ExecuteCommand((dynamic)command.Body, command);
} }
catch (Exception ex) catch (Exception ex)
{ {
_logger.Error(ex, "Error occurred while executing task " + command.Name); _logger.Error(ex, "Error occurred while executing task {0}", command.Name);
} }
} }
} }
catch (ThreadAbortException ex) catch (ThreadAbortException ex)
{ {
_logger.Error(ex, "Thread aborted: " + ex.Message); _logger.Error(ex);
Thread.ResetAbort(); Thread.ResetAbort();
} }
catch (Exception ex) catch (Exception ex)
{ {
_logger.Error(ex, "Unknown error in thread: " + ex.Message); _logger.Error(ex, "Unknown error in thread");
} }
} }
@ -104,7 +104,7 @@ namespace NzbDrone.Core.Messaging.Commands
_logger.Trace("{0} <- {1} [{2}]", command.GetType().Name, handler.GetType().Name, commandModel.Duration.ToString()); _logger.Trace("{0} <- {1} [{2}]", command.GetType().Name, handler.GetType().Name, commandModel.Duration.ToString());
} }
private void BroadcastCommandUpdate(CommandModel command) private void BroadcastCommandUpdate(CommandModel command)
{ {
if (command.Body.SendUpdatesToClient) if (command.Body.SendUpdatesToClient)

View File

@ -21,7 +21,7 @@ namespace NzbDrone.Core.Messaging.Events
_taskFactory = new TaskFactory(); _taskFactory = new TaskFactory();
} }
public void PublishEvent<TEvent>(TEvent @event) where TEvent : class ,IEvent public void PublishEvent<TEvent>(TEvent @event) where TEvent : class, IEvent
{ {
Ensure.That(@event, () => @event).IsNotNull(); Ensure.That(@event, () => @event).IsNotNull();
@ -58,7 +58,7 @@ namespace NzbDrone.Core.Messaging.Events
} }
catch (Exception e) catch (Exception e)
{ {
_logger.Error(e, string.Format("{0} failed while processing [{1}]", handler.GetType().Name, eventName)); _logger.Error(e, "{0} failed while processing [{1}]", handler.GetType().Name, eventName);
} }
} }

View File

@ -52,16 +52,16 @@ namespace NzbDrone.Core.Notifications.Boxcar
{ {
if (ex.Response.StatusCode == HttpStatusCode.Unauthorized) if (ex.Response.StatusCode == HttpStatusCode.Unauthorized)
{ {
_logger.Error(ex, "Access Token is invalid: " + ex.Message); _logger.Error(ex, "Access Token is invalid");
return new ValidationFailure("Token", "Access Token is invalid"); return new ValidationFailure("Token", "Access Token is invalid");
} }
_logger.Error(ex, "Unable to send test message: " + ex.Message); _logger.Error(ex, "Unable to send test message");
return new ValidationFailure("Token", "Unable to send test message"); return new ValidationFailure("Token", "Unable to send test message");
} }
catch (Exception ex) catch (Exception ex)
{ {
_logger.Error(ex, "Unable to send test message: " + ex.Message); _logger.Error(ex, "Unable to send test message");
return new ValidationFailure("", "Unable to send test message"); return new ValidationFailure("", "Unable to send test message");
} }
} }
@ -84,7 +84,7 @@ namespace NzbDrone.Core.Notifications.Boxcar
{ {
if (ex.Response.StatusCode == HttpStatusCode.Unauthorized) if (ex.Response.StatusCode == HttpStatusCode.Unauthorized)
{ {
_logger.Error(ex, "Access Token is invalid: " + ex.Message); _logger.Error(ex, "Access Token is invalid");
throw; throw;
} }

View File

@ -68,7 +68,7 @@ namespace NzbDrone.Core.Notifications.Email
} }
catch (Exception ex) catch (Exception ex)
{ {
_logger.Error(ex, "Unable to send test email: " + ex.Message); _logger.Error(ex, "Unable to send test email");
return new ValidationFailure("Server", "Unable to send test email"); return new ValidationFailure("Server", "Unable to send test email");
} }

View File

@ -152,7 +152,7 @@ namespace NzbDrone.Core.Notifications.Growl
} }
catch (Exception ex) catch (Exception ex)
{ {
_logger.Error(ex, "Unable to send test message: " + ex.Message); _logger.Error(ex, "Unable to send test message");
return new ValidationFailure("Host", "Unable to send test message"); return new ValidationFailure("Host", "Unable to send test message");
} }

View File

@ -34,7 +34,7 @@ namespace NzbDrone.Core.Notifications.Join
catch (JoinException ex) catch (JoinException ex)
{ {
_logger.Error(ex, "Unable to send Join message."); _logger.Error(ex, "Unable to send Join message.");
throw ex; throw;
} }
} }

View File

@ -52,7 +52,7 @@ namespace NzbDrone.Core.Notifications.Emby
} }
catch (Exception ex) catch (Exception ex)
{ {
_logger.Error(ex, "Unable to send test message: " + ex.Message); _logger.Error(ex, "Unable to send test message");
return new ValidationFailure("Host", "Unable to send test message: " + ex.Message); return new ValidationFailure("Host", "Unable to send test message: " + ex.Message);
} }

View File

@ -42,7 +42,7 @@ namespace NzbDrone.Core.Notifications
qualityString += " Proper"; qualityString += " Proper";
} }
} }
if (series.SeriesType == SeriesTypes.Daily) if (series.SeriesType == SeriesTypes.Daily)
{ {
var episode = episodes.First(); var episode = episodes.First();
@ -69,7 +69,7 @@ namespace NzbDrone.Core.Notifications
private bool ShouldHandleSeries(ProviderDefinition definition, Series series) private bool ShouldHandleSeries(ProviderDefinition definition, Series series)
{ {
var notificationDefinition = (NotificationDefinition) definition; var notificationDefinition = (NotificationDefinition)definition;
if (notificationDefinition.Tags.Empty()) if (notificationDefinition.Tags.Empty())
{ {
@ -90,7 +90,8 @@ namespace NzbDrone.Core.Notifications
public void Handle(EpisodeGrabbedEvent message) public void Handle(EpisodeGrabbedEvent message)
{ {
var grabMessage = new GrabMessage { var grabMessage = new GrabMessage
{
Message = GetMessage(message.Episode.Series, message.Episode.Episodes, message.Episode.ParsedEpisodeInfo.Quality), Message = GetMessage(message.Episode.Series, message.Episode.Episodes, message.Episode.ParsedEpisodeInfo.Quality),
Series = message.Episode.Series, Series = message.Episode.Series,
Quality = message.Episode.ParsedEpisodeInfo.Quality, Quality = message.Episode.ParsedEpisodeInfo.Quality,
@ -107,7 +108,7 @@ namespace NzbDrone.Core.Notifications
catch (Exception ex) catch (Exception ex)
{ {
_logger.Error(ex, "Unable to send OnGrab notification to: " + notification.Definition.Name); _logger.Error(ex, "Unable to send OnGrab notification to {0}", notification.Definition.Name);
} }
} }
} }

View File

@ -75,7 +75,7 @@ namespace NzbDrone.Core.Notifications.NotifyMyAndroid
} }
catch (Exception ex) catch (Exception ex)
{ {
_logger.Error(ex, "Unable to send test message: " + ex.Message); _logger.Error(ex, "Unable to send test message");
return new ValidationFailure("ApiKey", "Unable to send test message"); return new ValidationFailure("ApiKey", "Unable to send test message");
} }

View File

@ -63,7 +63,7 @@ namespace NzbDrone.Core.Notifications.Plex
} }
catch (Exception ex) catch (Exception ex)
{ {
_logger.Error(ex, "Unable to send test message: " + ex.Message); _logger.Error(ex, "Unable to send test message");
return new ValidationFailure("Host", "Unable to send test message"); return new ValidationFailure("Host", "Unable to send test message");
} }

View File

@ -175,12 +175,12 @@ namespace NzbDrone.Core.Notifications.Plex
} }
catch(PlexAuthenticationException ex) catch(PlexAuthenticationException ex)
{ {
_logger.Error(ex, "Unable to connect to Plex Server: " + ex.Message); _logger.Error(ex, "Unable to connect to Plex Server");
return new ValidationFailure("Username", "Incorrect username or password"); return new ValidationFailure("Username", "Incorrect username or password");
} }
catch (Exception ex) catch (Exception ex)
{ {
_logger.Error(ex, "Unable to connect to Plex Server: " + ex.Message); _logger.Error(ex, "Unable to connect to Plex Server");
return new ValidationFailure("Host", "Unable to connect to Plex Server"); return new ValidationFailure("Host", "Unable to connect to Plex Server");
} }

View File

@ -94,7 +94,7 @@ namespace NzbDrone.Core.Notifications.Prowl
} }
catch (Exception ex) catch (Exception ex)
{ {
_logger.Error(ex, "Unable to send test message: " + ex.Message); _logger.Error(ex, "Unable to send test message");
return new ValidationFailure("ApiKey", "Unable to send test message"); return new ValidationFailure("ApiKey", "Unable to send test message");
} }

View File

@ -42,7 +42,7 @@ namespace NzbDrone.Core.Notifications.PushBullet
} }
catch (PushBulletException ex) catch (PushBulletException ex)
{ {
_logger.Error(ex, "Unable to send test message to: " + channelTag); _logger.Error(ex, "Unable to send test message to {0}", channelTag);
error = true; error = true;
} }
} }
@ -61,7 +61,7 @@ namespace NzbDrone.Core.Notifications.PushBullet
} }
catch (PushBulletException ex) catch (PushBulletException ex)
{ {
_logger.Error(ex, "Unable to send test message to: " + deviceId); _logger.Error(ex, "Unable to send test message to {0}", deviceId);
error = true; error = true;
} }
} }
@ -101,16 +101,16 @@ namespace NzbDrone.Core.Notifications.PushBullet
{ {
if (ex.Response.StatusCode == HttpStatusCode.Unauthorized) if (ex.Response.StatusCode == HttpStatusCode.Unauthorized)
{ {
_logger.Error(ex, "API Key is invalid: " + ex.Message); _logger.Error(ex, "API Key is invalid");
return new ValidationFailure("ApiKey", "API Key is invalid"); return new ValidationFailure("ApiKey", "API Key is invalid");
} }
_logger.Error(ex, "Unable to send test message: " + ex.Message); _logger.Error(ex, "Unable to send test message");
return new ValidationFailure("ApiKey", "Unable to send test message"); return new ValidationFailure("ApiKey", "Unable to send test message");
} }
catch (Exception ex) catch (Exception ex)
{ {
_logger.Error(ex, "Unable to send test message: " + ex.Message); _logger.Error(ex, "Unable to send test message");
return new ValidationFailure("", "Unable to send test message"); return new ValidationFailure("", "Unable to send test message");
} }
@ -165,7 +165,7 @@ namespace NzbDrone.Core.Notifications.PushBullet
{ {
if (ex.Response.StatusCode == HttpStatusCode.Unauthorized) if (ex.Response.StatusCode == HttpStatusCode.Unauthorized)
{ {
_logger.Error(ex, "API Key is invalid: " + ex.Message); _logger.Error(ex, "API Key is invalid");
throw; throw;
} }

View File

@ -73,30 +73,30 @@ namespace NzbDrone.Core.Notifications.Pushalot
{ {
if (ex.Response.StatusCode == HttpStatusCode.Unauthorized) if (ex.Response.StatusCode == HttpStatusCode.Unauthorized)
{ {
_logger.Error(ex, "Authentication Token is invalid: " + ex.Message); _logger.Error(ex, "Authentication Token is invalid");
return new ValidationFailure("AuthToken", "Authentication Token is invalid"); return new ValidationFailure("AuthToken", "Authentication Token is invalid");
} }
if (ex.Response.StatusCode == HttpStatusCode.NotAcceptable) if (ex.Response.StatusCode == HttpStatusCode.NotAcceptable)
{ {
_logger.Error(ex, "Message limit reached: " + ex.Message); _logger.Error(ex, "Message limit reached");
return new ValidationFailure("AuthToken", "Message limit reached"); return new ValidationFailure("AuthToken", "Message limit reached");
} }
if (ex.Response.StatusCode == HttpStatusCode.Gone) if (ex.Response.StatusCode == HttpStatusCode.Gone)
{ {
_logger.Error(ex, "Authorization Token is no longer valid: " + ex.Message); _logger.Error(ex, "Authorization Token is no longer valid");
return new ValidationFailure("AuthToken", "Authorization Token is no longer valid, please use a new one."); return new ValidationFailure("AuthToken", "Authorization Token is no longer valid, please use a new one.");
} }
var response = Json.Deserialize<PushalotResponse>(ex.Response.Content); var response = Json.Deserialize<PushalotResponse>(ex.Response.Content);
_logger.Error(ex, "Unable to send test message: " + ex.Message); _logger.Error(ex, "Unable to send test message");
return new ValidationFailure("AuthToken", response.Description); return new ValidationFailure("AuthToken", response.Description);
} }
catch (Exception ex) catch (Exception ex)
{ {
_logger.Error(ex, "Unable to send test message: " + ex.Message); _logger.Error(ex, "Unable to send test message");
return new ValidationFailure("", "Unable to send test message"); return new ValidationFailure("", "Unable to send test message");
} }

View File

@ -59,7 +59,7 @@ namespace NzbDrone.Core.Notifications.Pushover
} }
catch (Exception ex) catch (Exception ex)
{ {
_logger.Error(ex, "Unable to send test message: " + ex.Message); _logger.Error(ex, "Unable to send test message");
return new ValidationFailure("ApiKey", "Unable to send test message"); return new ValidationFailure("ApiKey", "Unable to send test message");
} }

View File

@ -51,7 +51,7 @@ namespace NzbDrone.Core.Notifications.Telegram
} }
catch (Exception ex) catch (Exception ex)
{ {
_logger.Error(ex, "Unable to send test message: " + ex.Message); _logger.Error(ex, "Unable to send test message");
var restException = ex as RestException; var restException = ex as RestException;

View File

@ -131,7 +131,7 @@ namespace NzbDrone.Core.Notifications.Twitter
} }
catch (Exception ex) catch (Exception ex)
{ {
_logger.Error(ex, "Unable to send test message: " + ex.Message); _logger.Error(ex, "Unable to send test message");
return new ValidationFailure("Host", "Unable to send test message"); return new ValidationFailure("Host", "Unable to send test message");
} }
return null; return null;

View File

@ -115,7 +115,7 @@ namespace NzbDrone.Core.Notifications.Xbmc
} }
catch (Exception ex) catch (Exception ex)
{ {
_logger.Error(ex, "Unable to send test message: " + ex.Message); _logger.Error(ex, "Unable to send test message");
return new ValidationFailure("Host", "Unable to send test message"); return new ValidationFailure("Host", "Unable to send test message");
} }

View File

@ -401,7 +401,7 @@ namespace NzbDrone.Core.Parser
catch (Exception e) catch (Exception e)
{ {
if (!title.ToLower().Contains("password") && !title.ToLower().Contains("yenc")) if (!title.ToLower().Contains("password") && !title.ToLower().Contains("yenc"))
Logger.Error(e, "An error has occurred while trying to parse " + title); Logger.Error(e, "An error has occurred while trying to parse {0}", title);
} }
Logger.Debug("Unable to parse {0}", title); Logger.Debug("Unable to parse {0}", title);
@ -500,7 +500,7 @@ namespace NzbDrone.Core.Parser
return title; return title;
} }
private static SeriesTitleInfo GetSeriesTitleInfo(string title) private static SeriesTitleInfo GetSeriesTitleInfo(string title)
{ {
var seriesTitleInfo = new SeriesTitleInfo(); var seriesTitleInfo = new SeriesTitleInfo();

View File

@ -78,7 +78,7 @@ namespace NzbDrone.Core.RootFolders
//We don't want an exception to prevent the root folders from loading in the UI, so they can still be deleted //We don't want an exception to prevent the root folders from loading in the UI, so they can still be deleted
catch (Exception ex) catch (Exception ex)
{ {
_logger.Error(ex, "Unable to get free space and unmapped folders for root folder: " + folder.Path); _logger.Error(ex, "Unable to get free space and unmapped folders for root folder {0}", folder.Path);
folder.FreeSpace = 0; folder.FreeSpace = 0;
folder.UnmappedFolders = new List<UnmappedFolder>(); folder.UnmappedFolders = new List<UnmappedFolder>();
} }

View File

@ -53,9 +53,7 @@ namespace NzbDrone.Core.Tv
} }
catch (IOException ex) catch (IOException ex)
{ {
var errorMessage = string.Format("Unable to move series from '{0}' to '{1}'", source, destination); _logger.Error(ex, "Unable to move series from '{0}' to '{1}'", source, destination);
_logger.Error(ex, errorMessage);
throw; throw;
} }

View File

@ -77,7 +77,7 @@ namespace NzbDrone.Core.Tv
} }
catch (Exception e) catch (Exception e)
{ {
_logger.Fatal(e, "An error has occurred while updating episode info for series {0}. {1}", series, episode)); _logger.Fatal(e, "An error has occurred while updating episode info for series {0}. {1}", series, episode);
failCount++; failCount++;
} }
} }

View File

@ -51,7 +51,7 @@ namespace NzbDrone.Core.Tv
_logger.ProgressInfo("Updating Info for {0}", series.Title); _logger.ProgressInfo("Updating Info for {0}", series.Title);
Tuple<Series, List<Episode>> tuple; Tuple<Series, List<Episode>> tuple;
try try
{ {
tuple = _seriesInfo.GetSeriesInfo(series.TvdbId); tuple = _seriesInfo.GetSeriesInfo(series.TvdbId);
@ -167,7 +167,7 @@ namespace NzbDrone.Core.Tv
} }
catch (Exception e) catch (Exception e)
{ {
_logger.Error(e, "Couldn't refresh info for {0}".Inject(series)); _logger.Error(e, "Couldn't refresh info for {0}", series);
} }
} }
@ -180,7 +180,7 @@ namespace NzbDrone.Core.Tv
} }
catch (Exception e) catch (Exception e)
{ {
_logger.Error(e, "Couldn't rescan series {0}".Inject(series)); _logger.Error(e, "Couldn't rescan series {0}", series);
} }
} }
} }

View File

@ -148,7 +148,7 @@ namespace NzbDrone.Core.Update
} }
catch (Exception e) catch (Exception e)
{ {
_logger.Error(e, string.Format("Couldn't change the branch from [{0}] to [{1}].", currentBranch, package.Branch)); _logger.Error(e, "Couldn't change the branch from [{0}] to [{1}].", currentBranch, package.Branch);
} }
} }
} }

View File

@ -43,7 +43,7 @@ namespace NzbDrone.Host
} }
catch (Exception e) catch (Exception e)
{ {
_logger.Error(e, "Couldn't open default browser to " + url); _logger.Error(e, "Couldn't open default browser to {0}", url);
} }
} }
} }

View File

@ -9,7 +9,7 @@ namespace NzbDrone.Host
{ {
public static class PlatformValidation public static class PlatformValidation
{ {
private static readonly Logger Logger = NzbDroneLogger.GetLogger(typeof(PlatformValidation)); private static readonly Logger Logger = NzbDroneLogger.GetLogger(typeof(PlatformValidation));
private const string DOWNLOAD_LINK = "http://www.microsoft.com/en-us/download/details.aspx?id=42643"; private const string DOWNLOAD_LINK = "http://www.microsoft.com/en-us/download/details.aspx?id=42643";
@ -49,7 +49,7 @@ namespace NzbDrone.Host
} }
catch (Exception e) catch (Exception e)
{ {
Logger.Warn("Couldn't load {0}", e.Message); Logger.Warn(e, "Couldn't load {0}", assemblyString);
return false; return false;
} }

View File

@ -54,7 +54,7 @@ namespace NzbDrone.Mono.Disk
} }
catch (InvalidOperationException ex) catch (InvalidOperationException ex)
{ {
Logger.Error(ex, "Couldn't get free space for " + path); Logger.Error(ex, "Couldn't get free space for {0}", path);
} }
return null; return null;
@ -107,7 +107,7 @@ namespace NzbDrone.Mono.Disk
} }
catch (InvalidOperationException e) catch (InvalidOperationException e)
{ {
Logger.Error(e, "Couldn't get total space for " + path); Logger.Error(e, "Couldn't get total space for {0}", path);
} }
return null; return null;
@ -207,7 +207,7 @@ namespace NzbDrone.Mono.Disk
return g.gr_gid; return g.gr_gid;
} }
} }
} }

View File

@ -40,7 +40,7 @@ namespace NzbDrone.Update.UpdateEngine
} }
catch (InvalidOperationException e) catch (InvalidOperationException e)
{ {
_logger.Warn("Couldn't start NzbDrone Service (Most likely due to permission issues). falling back to console.", e); _logger.Warn(e, "Couldn't start NzbDrone Service (Most likely due to permission issues). falling back to console.");
StartConsole(installationFolder); StartConsole(installationFolder);
} }
} }

View File

@ -4,10 +4,12 @@
<s:String x:Key="/Default/CodeInspection/Highlighting/InspectionSeverities/=ClassNeverInstantiated_002EGlobal/@EntryIndexedValue">DO_NOT_SHOW</s:String> <s:String x:Key="/Default/CodeInspection/Highlighting/InspectionSeverities/=ClassNeverInstantiated_002EGlobal/@EntryIndexedValue">DO_NOT_SHOW</s:String>
<s:String x:Key="/Default/CodeInspection/Highlighting/InspectionSeverities/=ConvertIfStatementToReturnStatement/@EntryIndexedValue">DO_NOT_SHOW</s:String> <s:String x:Key="/Default/CodeInspection/Highlighting/InspectionSeverities/=ConvertIfStatementToReturnStatement/@EntryIndexedValue">DO_NOT_SHOW</s:String>
<s:String x:Key="/Default/CodeInspection/Highlighting/InspectionSeverities/=ConvertNullableToShortForm/@EntryIndexedValue">DO_NOT_SHOW</s:String> <s:String x:Key="/Default/CodeInspection/Highlighting/InspectionSeverities/=ConvertNullableToShortForm/@EntryIndexedValue">DO_NOT_SHOW</s:String>
<s:String x:Key="/Default/CodeInspection/Highlighting/InspectionSeverities/=FormatStringProblem/@EntryIndexedValue">ERROR</s:String>
<s:String x:Key="/Default/CodeInspection/Highlighting/InspectionSeverities/=FunctionRecursiveOnAllPaths/@EntryIndexedValue">ERROR</s:String> <s:String x:Key="/Default/CodeInspection/Highlighting/InspectionSeverities/=FunctionRecursiveOnAllPaths/@EntryIndexedValue">ERROR</s:String>
<s:String x:Key="/Default/CodeInspection/Highlighting/InspectionSeverities/=InvokeAsExtensionMethod/@EntryIndexedValue">ERROR</s:String> <s:String x:Key="/Default/CodeInspection/Highlighting/InspectionSeverities/=InvokeAsExtensionMethod/@EntryIndexedValue">ERROR</s:String>
<s:String x:Key="/Default/CodeInspection/Highlighting/InspectionSeverities/=LocalizableElement/@EntryIndexedValue">DO_NOT_SHOW</s:String> <s:String x:Key="/Default/CodeInspection/Highlighting/InspectionSeverities/=LocalizableElement/@EntryIndexedValue">DO_NOT_SHOW</s:String>
<s:String x:Key="/Default/CodeInspection/Highlighting/InspectionSeverities/=NUnit_002ENonPublicMethodWithTestAttribute/@EntryIndexedValue">ERROR</s:String> <s:String x:Key="/Default/CodeInspection/Highlighting/InspectionSeverities/=NUnit_002ENonPublicMethodWithTestAttribute/@EntryIndexedValue">ERROR</s:String>
<s:String x:Key="/Default/CodeInspection/Highlighting/InspectionSeverities/=PossibleIntendedRethrow/@EntryIndexedValue">ERROR</s:String>
<s:String x:Key="/Default/CodeInspection/Highlighting/InspectionSeverities/=ReturnTypeCanBeEnumerable_002EGlobal/@EntryIndexedValue">HINT</s:String> <s:String x:Key="/Default/CodeInspection/Highlighting/InspectionSeverities/=ReturnTypeCanBeEnumerable_002EGlobal/@EntryIndexedValue">HINT</s:String>
<s:String x:Key="/Default/CodeInspection/Highlighting/InspectionSeverities/=StringLiteralTypo/@EntryIndexedValue">WARNING</s:String> <s:String x:Key="/Default/CodeInspection/Highlighting/InspectionSeverities/=StringLiteralTypo/@EntryIndexedValue">WARNING</s:String>
<s:String x:Key="/Default/CodeInspection/Highlighting/InspectionSeverities/=TestClassNameDoesNotMatchFileNameWarning/@EntryIndexedValue">WARNING</s:String> <s:String x:Key="/Default/CodeInspection/Highlighting/InspectionSeverities/=TestClassNameDoesNotMatchFileNameWarning/@EntryIndexedValue">WARNING</s:String>