Skip to content

Commit

Permalink
Log message of unexpected exception in ThrowsAny (dotnet#64064)
Browse files Browse the repository at this point in the history
* Log message of unexpected exception in ThrowsAny

* Update AssertExtensions.cs
  • Loading branch information
danmoseley authored Jan 21, 2022
1 parent 338fa9f commit e2da32c
Showing 1 changed file with 1 addition and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -209,7 +209,7 @@ private static void ThrowsAnyInternal(Action action, params Type[] exceptionType
if (exceptionTypes.Any(t => t.Equals(exceptionType)))
return;

throw new XunitException($"Expected one of: ({string.Join<Type>(", ", exceptionTypes)}) -> Actual: ({exceptionType})");
throw new XunitException($"Expected one of: ({string.Join<Type>(", ", exceptionTypes)}) -> Actual: ({exceptionType}): {e}"); // Log message and callstack to help diagnosis
}

throw new XunitException($"Expected one of: ({string.Join<Type>(", ", exceptionTypes)}) -> Actual: No exception thrown");
Expand Down

0 comments on commit e2da32c

Please sign in to comment.