Fixed: Logging full error message to database

This commit is contained in:
Mark McDowall 2017-06-10 16:25:14 -07:00
parent d7cb5090fc
commit d0e226e269
No known key found for this signature in database
GPG Key ID: D4CEFA9A718052E0
12 changed files with 43 additions and 41 deletions

View File

@ -68,7 +68,7 @@ namespace NzbDrone.Api.Indexers
}
catch (ReleaseDownloadException ex)
{
_logger.Error(ex);
_logger.Error(ex, ex.Message);
throw new NzbDroneClientException(HttpStatusCode.Conflict, "Getting release from indexer failed");
}

View File

@ -191,12 +191,13 @@ namespace NzbDrone.Core.Download.Clients.Deluge
}
catch (DownloadClientAuthenticationException ex)
{
_logger.Error(ex);
_logger.Error(ex, ex.Message);
return new NzbDroneValidationFailure("Password", "Authentication failed");
}
catch (WebException ex)
{
_logger.Error(ex);
_logger.Error(ex, "Unble to test connection");
switch (ex.Status)
{
case WebExceptionStatus.ConnectFailure:
@ -220,7 +221,7 @@ namespace NzbDrone.Core.Download.Clients.Deluge
}
catch (Exception ex)
{
_logger.Error(ex);
_logger.Error(ex, "Failed to test connection");
return new NzbDroneValidationFailure(string.Empty, "Unknown exception: " + ex.Message);
}
@ -271,7 +272,7 @@ namespace NzbDrone.Core.Download.Clients.Deluge
}
catch (Exception ex)
{
_logger.Error(ex);
_logger.Error(ex, "Unable to get torrents");
return new NzbDroneValidationFailure(string.Empty, "Failed to get the list of torrents: " + ex.Message);
}

View File

@ -320,12 +320,12 @@ namespace NzbDrone.Core.Download.Clients.DownloadStation
}
catch (DownloadClientAuthenticationException ex) // User could not have permission to access to downloadstation
{
_logger.Error(ex);
_logger.Error(ex, ex.Message);
return new NzbDroneValidationFailure(string.Empty, ex.Message);
}
catch (Exception ex)
{
_logger.Error(ex);
_logger.Error(ex, "Error testing Torrent Download Station");
return new NzbDroneValidationFailure(string.Empty, $"Unknown exception: {ex.Message}");
}
}
@ -346,7 +346,7 @@ namespace NzbDrone.Core.Download.Clients.DownloadStation
}
catch (WebException ex)
{
_logger.Error(ex);
_logger.Error(ex, "Unable to connect to Torrent Download Station");
if (ex.Status == WebExceptionStatus.ConnectFailure)
{
@ -359,7 +359,7 @@ namespace NzbDrone.Core.Download.Clients.DownloadStation
}
catch (Exception ex)
{
_logger.Error(ex);
_logger.Error(ex, "Error testing Torrent Download Station");
return new NzbDroneValidationFailure(string.Empty, $"Unknown exception: {ex.Message}");
}
}

View File

@ -234,12 +234,12 @@ namespace NzbDrone.Core.Download.Clients.DownloadStation
}
catch (DownloadClientAuthenticationException ex) // User could not have permission to access to downloadstation
{
_logger.Error(ex);
_logger.Error(ex, ex.Message);
return new NzbDroneValidationFailure(string.Empty, ex.Message);
}
catch (Exception ex)
{
_logger.Error(ex);
_logger.Error(ex, "Error testing Usenet Download Station");
return new NzbDroneValidationFailure(string.Empty, $"Unknown exception: {ex.Message}");
}
}
@ -260,7 +260,7 @@ namespace NzbDrone.Core.Download.Clients.DownloadStation
}
catch (WebException ex)
{
_logger.Error(ex);
_logger.Error(ex, "Unable to connect to Usenet Download Station");
if (ex.Status == WebExceptionStatus.ConnectFailure)
{
@ -273,7 +273,7 @@ namespace NzbDrone.Core.Download.Clients.DownloadStation
}
catch (Exception ex)
{
_logger.Error(ex);
_logger.Error(ex, "Error testing Torrent Download Station");
return new NzbDroneValidationFailure(string.Empty, "Unknown exception: " + ex.Message);
}
}

View File

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

View File

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

View File

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

View File

@ -57,7 +57,7 @@ namespace NzbDrone.Core.Download.Clients.Sabnzbd
}
catch (DownloadClientException ex)
{
_logger.Warn("Couldn't get download queue. {0}", ex.Message);
_logger.Warn(ex, "Couldn't get download queue. {0}", ex.Message);
return Enumerable.Empty<DownloadClientItem>();
}
@ -120,7 +120,8 @@ namespace NzbDrone.Core.Download.Clients.Sabnzbd
}
catch (DownloadClientException ex)
{
_logger.Error(ex);
_logger.Warn(ex, "Couldn't get download queue. {0}", ex.Message);
return Enumerable.Empty<DownloadClientItem>();
}
@ -388,7 +389,7 @@ namespace NzbDrone.Core.Download.Clients.Sabnzbd
}
catch (Exception ex)
{
_logger.Error(ex);
_logger.Error(ex, ex.Message);
return new ValidationFailure("Host", "Unable to connect to SABnzbd");
}
}

View File

@ -41,7 +41,7 @@ namespace NzbDrone.Core.Download.Clients.Transmission
}
catch (DownloadClientException ex)
{
_logger.Error(ex);
_logger.Error(ex, ex.Message);
return Enumerable.Empty<DownloadClientItem>();
}
@ -205,7 +205,7 @@ namespace NzbDrone.Core.Download.Clients.Transmission
}
catch (DownloadClientAuthenticationException ex)
{
_logger.Error(ex);
_logger.Error(ex, ex.Message);
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)
@ -213,7 +213,7 @@ namespace NzbDrone.Core.Download.Clients.Transmission
}
catch (DownloadClientUnavailableException ex)
{
_logger.Error(ex);
_logger.Error(ex, ex.Message);
return new NzbDroneValidationFailure("Host", "Unable to connect")
{
@ -222,7 +222,7 @@ namespace NzbDrone.Core.Download.Clients.Transmission
}
catch (Exception ex)
{
_logger.Error(ex);
_logger.Error(ex, "Failed to test");
return new NzbDroneValidationFailure(string.Empty, "Unknown exception: " + ex.Message);
}
}
@ -237,7 +237,7 @@ namespace NzbDrone.Core.Download.Clients.Transmission
}
catch (Exception ex)
{
_logger.Error(ex);
_logger.Error(ex, "Failed to get torrents");
return new NzbDroneValidationFailure(string.Empty, "Failed to get the list of torrents: " + ex.Message);
}

View File

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

View File

@ -48,7 +48,7 @@ namespace NzbDrone.Core.Messaging.Commands
}
catch (ThreadAbortException ex)
{
_logger.Error(ex);
_logger.Error(ex, "Thread aborted");
Thread.ResetAbort();
}
catch (Exception ex)