Skip to content

Commit

Permalink
rethrow TargetInvocationException if an inner exception is unavailable
Browse files Browse the repository at this point in the history
  • Loading branch information
Cryptoc1 committed Sep 2, 2024
1 parent 7b102d1 commit 59042eb
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/OperationInvoker/OperationInvoker.cs
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ await Unsafe.As<Task>(
catch( TargetInvocationException exception )
{
// NOTE: rethrow the exception of the target invocation
throw exception.InnerException!;
throw exception.InnerException ?? exception;
}
}

Expand All @@ -39,7 +39,7 @@ public async Task<TResult> Invoke<TResult>( IOperation<TResult> operation, Cance
catch( TargetInvocationException exception )
{
// NOTE: rethrow the exception of the target invocation
throw exception.InnerException!;
throw exception.InnerException ?? exception;
}
}

Expand Down

0 comments on commit 59042eb

Please sign in to comment.