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

Conversation

Projects
None yet
2 participants
@jnyrup
Copy link
Collaborator

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

@dennisdoomen
Copy link
Member

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

This comment has been minimized.

Copy link
Collaborator Author

commented May 5, 2019

Found a related issue #696

@dennisdoomen

This comment has been minimized.

Copy link
Member

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

continuous-integration/appveyor/pr AppVeyor build succeeded
Details

@jnyrup jnyrup deleted the jnyrup:NotThrow branch May 26, 2019

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.