This repository was archived by the owner on Nov 30, 2024. It is now read-only.
Prevent MultipleExceptionError#add
from allowing self to be added to the list of all_exceptions
#2133
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This was exposed by #2112 which
contains a spec which uses
describe_successfully
which seems to somehowadd the existing
MultipleExceptionError
to itself when it fails. Thisdoes not happen if the example passes (presumably because an error
is not generated).
When we format the exception
here
we use FlatMap, which is going to continuously unpack the exception,
causing infinite recursion.
This patch prevents
MultipleExceptionError::InterfaceTag#add
fromallowing
self
to be included in theall_exceptions
array. This fixesthe problem.
As far as I can tell from running our suite, the
self
being added casenever actually happens during normal RSpec execution and so adding this
is fine. I added a spec which demonstrates this behaviour in case that
turns out to be problematic in the future. I can't imagine that
happening though as this will precisely cause the same infinite
recursion bug.