-
-
Notifications
You must be signed in to change notification settings - Fork 753
Conversation
@JonRowe Just a note that this doesn't catch cause loops of more than one exception (e.g. when |
Thanks for reporting that, @seanwalbran! It sounds like the fix needs to be more sophisticated -- either it needs to keep track of all exceptions seen so far (e.g. via an extra arg passed as part of the recursion) so it can notice when it's seeing one it has already seeing, or maybe we should just put a hard limit on the max depth (e.g. 10 or 20 or something) and give up when we've followed |
849edd0
to
c374ec5
Compare
I've reworked this to take @seanwalbran's issue into account |
def final_exception(exception, previous=[]) | ||
if exception.cause && !previous.include?(exception.cause) | ||
previous << exception.cause | ||
final_exception(exception.cause, previous) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It'll probably be slightly faster if you call cause
only once:
def final_exception(exception, previous=[])
cause = exception.cause
return exception unless cause
return exception if previous.include?(cause)
previous << cause
final_exception(cause, previous)
end
Not a merge blocker, though.
LGTM otherwise. |
c374ec5
to
558cd49
Compare
Prevent possible infinite recursion
Any chance of a 3.5 release for this this? |
We could put out a patch release of |
I ran into this issue as well, any chance this will be released as a patch to 3.4? |
Hmm apparently I forgot to backport this so it was never released in recent patch versions, something I've just rectified with 3.4.3. |
I just got hit by this at 3.4.4 - expected? |
This should have been rectified in |
I'm sorry, I somehow worked around it and can't reproduce it now. |
…xception Prevent possible infinite recursion
Fixes #2127