-
Notifications
You must be signed in to change notification settings - Fork 37
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
Proposal: Support richer error messages #37
Comments
I believe we already include the key in the error message. We could also introduce a |
For including the key in the error message, I was thinking of something like:
I think the current behavior should be the default regardless, as its the most straightforward interface. I like the idea of validate_all. I'll see if I can work something up in the next week or two. |
I had a similar issue while implementing validation for A list of custom function may return more than one custom error message (one for each input validation), which makes tricky to return an useful feedback if the only supported format is |
My (strong :P) suggestion is to go with
We could even make the fields of this struct private so we can change them freely for the time being. Thoughts? |
This seems like a good shape for the errors (similar to Ecto.Changeset errors). If the errors are nested like Ecto.Changeset errors, then it will be easy to write reusable code for handling errors in general. |
It would be nice to be able to:
1.) Include the key's in the error messages and
2.) Support getting all of the errors at once
I have another layer of error reporting that I pass the result of
NimbleParsec.validate/2
into, and previously I was using a library I wrote https://github.com/albert-io/optimal for validating options. However, I'd rather use this, even though it doesn't have some of the features, since it is backed by a pillar of the community :DThe text was updated successfully, but these errors were encountered: