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); }