Correct SQLiteException Sentry filtering

This commit is contained in:
Qstick 2022-09-24 19:45:10 -05:00
parent 8a63f6ae37
commit 9db6289693
2 changed files with 4 additions and 1 deletions

View File

@ -1,4 +1,5 @@
using System; using System;
using System.Data.SQLite;
using System.Globalization; using System.Globalization;
using System.Linq; using System.Linq;
using FluentAssertions; using FluentAssertions;
@ -21,6 +22,7 @@ namespace NzbDrone.Common.Test.InstrumentationTests
private static Exception[] FilteredExceptions = new Exception[] private static Exception[] FilteredExceptions = new Exception[]
{ {
new UnauthorizedAccessException(), new UnauthorizedAccessException(),
new SQLiteException(SQLiteErrorCode.Locked, "database is locked"),
new AggregateException(new Exception[] new AggregateException(new Exception[]
{ {
new UnauthorizedAccessException(), new UnauthorizedAccessException(),
@ -30,6 +32,7 @@ namespace NzbDrone.Common.Test.InstrumentationTests
private static Exception[] NonFilteredExceptions = new Exception[] private static Exception[] NonFilteredExceptions = new Exception[]
{ {
new SQLiteException(SQLiteErrorCode.Error, "it's borked"),
new AggregateException(new Exception[] new AggregateException(new Exception[]
{ {
new UnauthorizedAccessException(), new UnauthorizedAccessException(),

View File

@ -248,7 +248,7 @@ namespace NzbDrone.Common.Instrumentation.Sentry
var isSentry = true; var isSentry = true;
var sqlEx = ex as SQLiteException; var sqlEx = ex as SQLiteException;
if (sqlEx != null && !FilteredSQLiteErrors.Contains(sqlEx.ResultCode)) if (sqlEx != null && FilteredSQLiteErrors.Contains(sqlEx.ResultCode))
{ {
isSentry = false; isSentry = false;
} }