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

Explicitly stated what parameter caused the error #105

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

kemoycampbell
Copy link

Previously the error would read, "Parameter cannot be less ... " but this is not helpful as it is too generic and could be from any of the parameters.
I added name field to the function validate!(param, options, name) then it is called as validate!(params[name], options, name) inside the def param function. The error message is updated inside the validation function as "The parameter #{name} ... "
since name is already supported there.

Previously the error would read, "Parameter cannot be less ... " but this is not helpful as it is too generic and could be from any of the parameters.
I added name field to the function validate!(param, options, name) then it is called as validate!(params[name], options, name) inside the def param function 
since name is already supported there.
@niekvenlo
Copy link

This would be nice addition. You may also want to update the spec, so that tests don't start failing:
spec/parameter_validations_spec.rb, for example, compares responses to strings like "Parameter is required"

@kemoycampbell
Copy link
Author

@niekvenlo, good catch. I have updated the specs with the correct responses.

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

2 participants