Example #1
0
        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);
        }
Example #2
0
 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));
     }
 }