Skip to content

Commit

Permalink
Lucene.Net.Util.LuceneTestCase (TearDown() + OneTimeTearDown()): use …
Browse files Browse the repository at this point in the history
…empty throw statement to preserve stack details, since we are still in the finally block.
  • Loading branch information
NightOwl888 committed Jan 17, 2025
1 parent ed1abbb commit 8bc1b38
Showing 1 changed file with 2 additions and 3 deletions.
5 changes: 2 additions & 3 deletions src/Lucene.Net.TestFramework/Util/LuceneTestCase.cs
Original file line number Diff line number Diff line change
Expand Up @@ -22,10 +22,8 @@
using System.Diagnostics.CodeAnalysis;
using System.Globalization;
using System.IO;
using System.Linq;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.ExceptionServices;
using System.Text.RegularExpressions;
using System.Threading;
using static Lucene.Net.Search.FieldCache;
Expand Down Expand Up @@ -981,7 +979,7 @@ System Properties
{
NUnit.Framework.TestContext.Error.WriteLine($"[ERROR] An exception occurred during TearDown:");
RandomizedContext.PrintStackTrace(ex, NUnit.Framework.TestContext.Error);
ExceptionDispatchInfo.Capture(ex).Throw();
throw; // LUCENENET: Throw to preserve stack details of original throw.
}
}

Expand Down Expand Up @@ -1054,6 +1052,7 @@ public virtual void OneTimeTearDown()
// LUCENENET: Patch NUnit so it will report a failure in stderr if there was an exception during teardown.
NUnit.Framework.TestContext.Error.WriteLine($"[ERROR] OneTimeTearDown: An exception occurred during RandomizedContext.DisposeResources() in {GetType().FullName}:");
RandomizedContext.PrintStackTrace(ex, NUnit.Framework.TestContext.Error);
throw; // LUCENENET: Throw to preserve stack details of original throw.
}
}

Expand Down

0 comments on commit 8bc1b38

Please sign in to comment.