MCPcopy Create free account
hub / github.com/FlaxEngine/FlaxEngine / ExceptionExpected

Method ExceptionExpected

Source/Engine/Debug/Assert.cs:337–353  ·  view source on GitHub ↗

Expect action to fail Type of exception to expect Action to expect User custom message to display

(Type exceptionType, Action action, string message = "")

Source from the content-addressed store, hash-verified

335 /// <param name="action">Action to expect</param>
336 /// <param name="message">User custom message to display</param>
337 [Conditional("FLAX_ASSERTIONS")]
338 public static void ExceptionExpected(Type exceptionType, Action action, string message = "")
339 {
340 try
341 {
342 action();
343 }
344 catch (Exception e)
345 {
346 if (exceptionType != e.GetType())
347 {
348 Fail(GetMessage("Expected exception of type " + exceptionType.FullName + " got " + e.GetType().FullName), message);
349 }
350 return;
351 }
352 Fail(GetMessage("Expected exception of type " + exceptionType.FullName), message);
353 }
354
355 public static string BooleanFailureMessage(bool expected)
356 {

Calls 2

GetMessageFunction · 0.85
GetTypeMethod · 0.45