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

Fix #1603, add closest predicate name in error message #3054

Merged

Conversation

fangpenlin
Copy link
Contributor

@fangpenlin fangpenlin commented May 22, 2017

Fix #1603, add closest predicate name in error message

@@ -152,7 +152,16 @@ def make(self, config, **kw):
weights.append(1 << n + 1)
preds.append(pred)
if kw:
raise ConfigurationError('Unknown predicate values: %r' % (kw,))
from difflib import get_close_matches
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Comment for future reviewers, import statement inside the function so that we only have to import it when we are about to raise a ConfigurationError.

Copy link
Member

@mmerickel mmerickel left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Very cool, thank you @fangpenlin!

@mmerickel mmerickel merged commit b3f153e into Pylons:master May 22, 2017
@fangpenlin fangpenlin deleted the feature.closest-predicate-match-error-msg branch May 22, 2017 22:11
mmerickel added a commit that referenced this pull request May 22, 2017
@ztane
Copy link
Contributor

ztane commented May 31, 2017

Wow! :D

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.

Helpful exceptions on "a named thing was not found"
4 participants