Skip to content

Commit 1a716d9

Browse files
committed
Delete unused old exception throwing
1 parent ea6c909 commit 1a716d9

File tree

3 files changed

+0
-43
lines changed

3 files changed

+0
-43
lines changed

src/Elasticsearch.Net/Elasticsearch.Net.csproj

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -84,7 +84,6 @@
8484
<Compile Include="ElasticLowLevelClient.Generated.cs" />
8585
<Compile Include="Exceptions\ElasticsearchClientException.cs" />
8686
<Compile Include="Exceptions\UnexpectedElasticsearchClientException.cs" />
87-
<Compile Include="Extensions\ExceptionExtensions.cs" />
8887
<Compile Include="Extensions\Extensions.cs" />
8988
<Compile Include="Extensions\Fluent.cs" />
9089
<Compile Include="Extensions\FormattableString.cs" />

src/Elasticsearch.Net/Extensions/ExceptionExtensions.cs

Lines changed: 0 additions & 21 deletions
This file was deleted.

src/Nest/CommonAbstractions/Extensions/ExceptionExtensions.cs

Lines changed: 0 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -1,30 +1,9 @@
11
using System;
2-
using System.Reflection;
3-
using System.Runtime.ExceptionServices;
42

53
namespace Nest
64
{
75
internal static class ExceptionExtensions
86
{
9-
private static readonly Lazy<MethodInfo> preserveStackTraceMethodInfo = new Lazy<MethodInfo>(() =>
10-
typeof(Exception).GetMethod("InternalPreserveStackTrace", BindingFlags.Instance | BindingFlags.NonPublic)
11-
);
12-
13-
public static void RethrowKeepingStackTrace(this Exception exception)
14-
{
15-
// In .Net 4.5 ExceptionDispatchInfo.Capture(exception).Throw();
16-
// But as NEST also still targets .NET 4.0 the old internal hack must be used
17-
if (preserveStackTraceMethodInfo.Value != null)
18-
{
19-
#if NET45
20-
preserveStackTraceMethodInfo.Value.Invoke(exception, null);
21-
#else
22-
ExceptionDispatchInfo.Capture(exception).Throw();
23-
#endif
24-
}
25-
throw exception;
26-
}
27-
287
internal static T ThrowWhen<T>(this T @object, Func<T, bool> predicate, string exceptionMessage)
298
{
309
var x = predicate?.Invoke(@object);

0 commit comments

Comments
 (0)