-
Notifications
You must be signed in to change notification settings - Fork 71
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Co-authored-by: Gáspár Nagy <[email protected]>
- Loading branch information
1 parent
4ee2734
commit 5cac594
Showing
8 changed files
with
418 additions
and
8 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
26 changes: 26 additions & 0 deletions
26
Plugins/Reqnroll.xUnit.ReqnrollPlugin/Runners/ExceptionsExtensions.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
// Contains Code from https://github.com/xunit/xunit/blob/v2/src/common/ExceptionExtensions.cs | ||
// originally published under Apache 2.0 license | ||
// Xunit v2 will be not developed further | ||
using System; | ||
using System.Reflection; | ||
|
||
namespace Reqnroll.xUnit.ReqnrollPlugin.Runners; | ||
|
||
static class ExceptionExtensions | ||
{ | ||
/// <summary> | ||
/// Unwraps an exception to remove any wrappers, like <see cref="TargetInvocationException"/>. | ||
/// </summary> | ||
/// <param name="ex">The exception to unwrap.</param> | ||
/// <returns>The unwrapped exception.</returns> | ||
public static Exception Unwrap(this Exception ex) | ||
{ | ||
while (true) | ||
{ | ||
var tiex = ex as TargetInvocationException; | ||
if (tiex == null) return ex; | ||
|
||
ex = tiex.InnerException; | ||
} | ||
} | ||
} |
Oops, something went wrong.