-
-
Notifications
You must be signed in to change notification settings - Fork 39
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
Add type to incorrect input messages #492
Comments
Are these messages intended to be shown to end users? I understand validation message in case of an API, when it is shown to a developer. In case of a HTML form, this messages happing sounds like a programming error and should rather be an excepction than a message shown to the user. |
@cebe See the 2nd part of response here - #514 (comment). At some point there were such exceptions. But then we discussed it and decided that handlers should not throw exceptions related with wrong input data. @vjik |
@cebe You are suggesting to be able to configure different behavior for API (throw exceptions) and forms (show messages), right? |
Kind of related - #526. |
Throw exception is not validator task. If it need, then should be code that process validator results and throw exception if need. |
Not sure about the correct solution but the point here is to differentiate between validation messages for a user and error messages for the programmer. Definition: Validation message for a user is a message displayed for the user that the user can understand and most importantly allows the user to fix the input. Error message for the programmer is a message that comes up when the validator is fed with data that can not appear in normal circumstances when users are filling the form, but somehow happen due to an error in the program. In this case the user is very likely not able to correct the input themselfs because the program has a bug. It does not make sense to show these messages to the user. |
Changed the milestone as I consider this a major design issue in how a validation library should work. |
@cebe what do you want to do with these errors? Would you somehow handle it differently from the rest of validation errors? Would you hide these from end users? |
@samdark answered in #546 (comment) |
Done by #736 |
Currently:
validator/src/Rule/AtLeast.php
Line 38 in e3a6c11
Added recently:
validator/src/Rule/BoolValue.php
Line 83 in dfdf19e
Funding
The text was updated successfully, but these errors were encountered: