-
Notifications
You must be signed in to change notification settings - Fork 95
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
Rspec has issues with 'cause' on 'Parslet::ParseFailed' #151
Comments
if others encounter this problem... this works.
|
You're right, the name collision is probably hurting parslet. Please propose a new name; I would also gladly receive a (breaking change) PR for this. We'll bump the version number to reflect this. |
…iled'. rename cause to parse_failure_cause
How about this one? Parslet::Atoms::Base#parse_with_debug I think the name collision should be fixed, however, it seems ok to use |
Pray tell: what is the collision in parse_with_debug? The local variable that we use? |
No collision in |
Yeah, Too bad that the PR seems to be abandoned - the issue here is a real one. Maybe you want to pick it up and produce a patch that is non-invasive? |
… cause called by Rspec
rspec seems to now traverse exception chains and attempts to properly format them for output. When it encounters a
Parslet::ParseFailed
exception it has problems because of thecause
method.In this case, rspec recursively calls
cause
on exceptions which works the first time to get theParslet::Cause
object, but fails after that becauseParslet::Cause
does not have acause
method.Fixing this is going to either require defining a
cause
method onParslet::Cause
that returnsnil
, or renaming thecause
method onParslet::ParseFailed
to something else.In addition, because Ruby automatically populates the
cause
of an exception with the original exception when re-raising exceptions, it is not possible to simply bypass this problem by raising a new exception without setting the cause.I would be inclined to suggest renaming the method since it is actually in conflict with a method on Exception that has been there since ruby 2.1.
I would be happy to create a pull request for this, but wanted to hear your thoughts on the approach since this would represent a fairly significant and possibly breaking change.
The text was updated successfully, but these errors were encountered: