sinatra-param icon indicating copy to clipboard operation
sinatra-param copied to clipboard

Explicitly stated what parameter caused the error

Open kemoycampbell opened this issue 4 years ago • 2 comments

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.

kemoycampbell avatar Aug 04 '21 19:08 kemoycampbell

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"

niekvenlo avatar Mar 07 '22 03:03 niekvenlo

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

kemoycampbell avatar Mar 09 '22 15:03 kemoycampbell