internal static Exception ApplyFlags(Exception ex, RecordExceptionFlags flags) { if (flags.HasFlag(RecordExceptionFlags.UnwindTargetExceptions)) { ex = UnwindTargetException(ex); } if (ex is AssertException && flags.HasFlag(RecordExceptionFlags.StrictVerification)) { throw SpecFailure.CannotAssertAssertExceptions(); } return(ex); }
public static Exception Exception(Action action, RecordExceptionFlags flags) { try { SyncContextImpl.Run(action); return(null); } catch (Exception ex) { if (ex is AssertException && flags.HasFlag(RecordExceptionFlags.IgnoreAssertExceptions)) { throw; } return(ApplyFlags(ex, flags)); } }