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

Generalize backtrace check on DelegationError. #11850

Merged
merged 1 commit into from Aug 21, 2013
Merged

Generalize backtrace check on DelegationError. #11850

merged 1 commit into from Aug 21, 2013

Conversation

razielgn
Copy link
Contributor

Different Ruby implementations present backtraces differently, as it should be an information consumed by humans.
A better implementation should use data from the error, in this case returned by NoMethodError#name.

Fixes issues with Rubinius, which presents backtraces differently from MRI.

/cc @dbussink

@josevalim
Copy link
Contributor

Thanks. The current solution seems to be prone for false positives though. Maybe we could rescue and use respond_to? to check if it is avaialble or not, instead of relying on stacktraces?

Different Ruby implementations present backtraces differently, as
it should be an information consumed by humans.
A better implementation should use data from the error, in this case
returned by NoMethodError#name.

Fixes issues with Rubinius, which presents backtraces differently from
MRI.
@razielgn
Copy link
Contributor Author

Thanks. The current solution seems to be prone for false positives though. Maybe we could rescue and use respond_to? to check if it is avaialble or not, instead of relying on stacktraces?

Spent some more time on it and managed to remove backtraces completely by using NoMethodError#name�, which carries the not found method. 😄

@steveklabnik
Copy link
Member

Neat! 👍

rafaelfranca added a commit that referenced this pull request Aug 21, 2013
Generalize backtrace check on DelegationError.
@rafaelfranca rafaelfranca merged commit 6aaa044 into rails:master Aug 21, 2013
@razielgn
Copy link
Contributor Author

Awesome, thanks!

@razielgn razielgn deleted the mod-delegation-backtrace branch August 21, 2013 16:18
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants