Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Unwrapping of AggregateExceptions #1041

Merged
merged 1 commit into from May 26, 2019
Merged

Conversation

@jnyrup
Copy link
Member

@jnyrup jnyrup commented May 5, 2019

After #1038 got merged, the logic for unwrapping AggregateException becomes a lot easier, as we now know that FluentAssertions doesn't wrap exceptions in an AggregateException.

Calling Throw<TException> is designed to also succeed if an exception of type TException is wrapped inside an AggregateException.
The same behavior should be present for NotThrow<TException>

This PR solves these problems.

  1. NotThrow<TException> didn't look inside AggregateExceptions to see if an exception of type TException was thrown, which made it non-symmetric to Throw<TException>.
  2. GetFirstNonAggregateException only looked at the InnerException of an AggregateException instead of InnerExceptions (all wrapped exceptions). E.g. it failed to handle if TException was the second InnerException.
  3. As we no longer unnecessarily wrap exceptions, InterceptException unwrapped to much.
@jnyrup jnyrup requested a review from dennisdoomen May 5, 2019
Copy link
Member

@dennisdoomen dennisdoomen left a comment

I can't fully predict the effect of these changes. I'll try to run these changes to my current project code-base to see if anything breaks.

@jnyrup
Copy link
Member Author

@jnyrup jnyrup commented May 5, 2019

Found a related issue #696

@dennisdoomen
Copy link
Member

@dennisdoomen dennisdoomen commented May 26, 2019

Tried to run this PR against the 20K tests of a project I'm involved with and everything seems to be fine.

@dennisdoomen dennisdoomen merged commit 34f4ce1 into fluentassertions:master May 26, 2019
1 check passed
@jnyrup jnyrup deleted the NotThrow branch May 26, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Linked issues

Successfully merging this pull request may close these issues.

None yet

2 participants