From 9db628969359470f81741588e4b6f6e87f43bc49 Mon Sep 17 00:00:00 2001 From: Qstick Date: Sat, 24 Sep 2022 19:45:10 -0500 Subject: [PATCH] Correct SQLiteException Sentry filtering --- .../InstrumentationTests/SentryTargetFixture.cs | 3 +++ src/NzbDrone.Common/Instrumentation/Sentry/SentryTarget.cs | 2 +- 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/src/NzbDrone.Common.Test/InstrumentationTests/SentryTargetFixture.cs b/src/NzbDrone.Common.Test/InstrumentationTests/SentryTargetFixture.cs index dc0fbaffb..0d6ec6d0f 100644 --- a/src/NzbDrone.Common.Test/InstrumentationTests/SentryTargetFixture.cs +++ b/src/NzbDrone.Common.Test/InstrumentationTests/SentryTargetFixture.cs @@ -1,4 +1,5 @@ using System; +using System.Data.SQLite; using System.Globalization; using System.Linq; using FluentAssertions; @@ -21,6 +22,7 @@ namespace NzbDrone.Common.Test.InstrumentationTests private static Exception[] FilteredExceptions = new Exception[] { new UnauthorizedAccessException(), + new SQLiteException(SQLiteErrorCode.Locked, "database is locked"), new AggregateException(new Exception[] { new UnauthorizedAccessException(), @@ -30,6 +32,7 @@ namespace NzbDrone.Common.Test.InstrumentationTests private static Exception[] NonFilteredExceptions = new Exception[] { + new SQLiteException(SQLiteErrorCode.Error, "it's borked"), new AggregateException(new Exception[] { new UnauthorizedAccessException(), diff --git a/src/NzbDrone.Common/Instrumentation/Sentry/SentryTarget.cs b/src/NzbDrone.Common/Instrumentation/Sentry/SentryTarget.cs index ac8f6f522..45cc679c4 100644 --- a/src/NzbDrone.Common/Instrumentation/Sentry/SentryTarget.cs +++ b/src/NzbDrone.Common/Instrumentation/Sentry/SentryTarget.cs @@ -248,7 +248,7 @@ namespace NzbDrone.Common.Instrumentation.Sentry var isSentry = true; var sqlEx = ex as SQLiteException; - if (sqlEx != null && !FilteredSQLiteErrors.Contains(sqlEx.ResultCode)) + if (sqlEx != null && FilteredSQLiteErrors.Contains(sqlEx.ResultCode)) { isSentry = false; }