-
-
Notifications
You must be signed in to change notification settings - Fork 374
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
Improve the error message informing the value that it got it #536
Improve the error message informing the value that it got it #536
Conversation
58ddbfc
to
7efdc3c
Compare
Hm I wish it would work like that but I'm afraid that this is a breaking change. :( Maybe make it an option? |
Hi hynek, thanks for your time review it :)
Oh sorry, I didn't consider that users would be relying/depending on the errors message raised by the validators.
Sure, do you have anything in mind? I mean, where would I introduce this option? |
If we want people to distinguish this So perhaps a new exception type |
What @wsanchez said SGTM! |
Hi @wsanchez, I not sure if I got all right.
Yep, I totally agree =)
Right, I agree with adding this new exception (and I can add in the next commit without any problem), but the "original issue" that I brought was not solved, the message still not-informative to the "end user" that informed an invalid value. So just to make sure that I got right, we are going to keep with the not-informative-enough message in order to avoid breaking changes right? |
Yeah, I think @hynek is saying that the current string can't change for compatibility, so adding a new type that at least can get you the data you need is an improvement. I agree that the default string could be better, and I'm less sympathetic to compatibility with code that's inspecting the string, but |
Firstly, having a dedicated class with a |
b0f22f5
to
b1961f9
Compare
8c815c7
to
3bfb793
Compare
4ddf28b
to
bd7e3bb
Compare
bd7e3bb
to
8f039da
Compare
Is there any further modification needed to proceed with the merge? |
All good, thank you for your patience and your contribution! |
Thank you, I'm glad that I could I contribute with this project somehow.=) |
I hope my lagginess doesn't discourage you from doing it more often. This year was awesome, but super stressful. 🙈 |
I would like to propose a change on the error message returned by the validator
is_callable()
.Currently, only a message "TypeError: 'x' must be callable" it's informed to the user, I would like to add the value that was passed to it within the message.
This approach besides given more information to the user resembles the errors messages returned by others validators that also include the value informed =)
Pull Request Check List
This is just a reminder about the most common mistakes. Please make sure that you tick all appropriate boxes. But please read our contribution guide at least once, it will save you unnecessary review cycles!
If an item doesn't apply to your pull request, check it anyway to make it apparent that there's nothing to do.
.pyi
).tests/typing_example.py
.docs/api.rst
by hand.@attr.s()
have to be added by hand too.versionadded
,versionchanged
, ordeprecated
directives..rst
files is written using semantic newlines.changelog.d
.If you have any questions to any of the points above, just submit and ask! This checklist is here to help you, not to deter you from contributing!