diff --git a/src/NzbDrone.Core/Instrumentation/DatabaseTarget.cs b/src/NzbDrone.Core/Instrumentation/DatabaseTarget.cs index 2f4cefdd5..02cb58231 100644 --- a/src/NzbDrone.Core/Instrumentation/DatabaseTarget.cs +++ b/src/NzbDrone.Core/Instrumentation/DatabaseTarget.cs @@ -97,6 +97,11 @@ namespace NzbDrone.Core.Instrumentation WritePostgresLog(log, connectionString); } } + catch (NpgsqlException ex) + { + InternalLogger.Error("Unable to save log event to database: {0}", ex); + throw; + } catch (SQLiteException ex) { InternalLogger.Error("Unable to save log event to database: {0}", ex); @@ -128,10 +133,8 @@ namespace NzbDrone.Core.Instrumentation private void WriteSqliteLog(Log log, string connectionString) { using (var connection = - new SQLiteConnection(_connectionStringFactory.LogDbConnectionString).OpenAndReturn()) + new SQLiteConnection(connectionString).OpenAndReturn()) { - connection.ConnectionString = connectionString; - connection.Open(); using (var sqlCommand = connection.CreateCommand()) { sqlCommand.CommandText = INSERT_COMMAND; diff --git a/src/NzbDrone.Test.Common/ExceptionVerification.cs b/src/NzbDrone.Test.Common/ExceptionVerification.cs index bcf417434..4ead02b8f 100644 --- a/src/NzbDrone.Test.Common/ExceptionVerification.cs +++ b/src/NzbDrone.Test.Common/ExceptionVerification.cs @@ -1,4 +1,4 @@ -using System; +using System; using System.Collections.Generic; using System.Linq; using System.Threading;