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

Properly set Zeitwerk::NameError#name #99

Merged
merged 1 commit into from Nov 29, 2019
Merged

Properly set Zeitwerk::NameError#name #99

merged 1 commit into from Nov 29, 2019

Conversation

casperisfine
Copy link
Contributor

@casperisfine casperisfine commented Nov 29, 2019

Context: rails/rails#37650

TL;DR; vanilla NameError has a #name accessor that is useful to distinguish wether the constant we were trying to load is missing, or if the NameError is caused by some dependent code.

e.g. being able to tell the difference between:

# foo_controller.rb
class FoosControler # The expected constant doesn't exist
end
# foo_controller.rb
class FooControler
 ::DoesNotExist # Another constant resolution issue was triggered by loading foo_controlle.rb
end

What this patch does is to respect the NameError#name contract.

@fxn for review please.

cc @rafaelfranca @etiennebarrie @Edouard-chin

@fxn
Copy link
Owner

fxn commented Nov 29, 2019

Thanks @casperisfine!

@fxn fxn merged commit c77975d into fxn:master Nov 29, 2019
@fxn
Copy link
Owner

fxn commented Nov 29, 2019

2.2.2 is out with this change.

@casperisfine
Copy link
Contributor Author

❤️

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

3 participants