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

Return multiple errors #90

Open
jtara opened this issue Aug 28, 2018 · 1 comment
Open

Return multiple errors #90

jtara opened this issue Aug 28, 2018 · 1 comment

Comments

@jtara
Copy link

jtara commented Aug 28, 2018

Currently, it seems to only return the first error found. So, e.g. API user gets an error, fixes the parameter, then gets an error on a different parameter. Rinse and repeat.

It would be useful to return multiple errors. To avoid the need for "rinse and repeat".

It begs the question, though, about "message" vs "errors". I'm not sure why they both exist in the first place? If it were to check and return errors for multiple parameters, what, logically, should "message be".

Multiple errors?

errors is an array, so there must have been some intent to return multiple errors. Is it just that that feature is not implemented, or am I doing something wrong?

@pjmartorell
Copy link

Follow this instructions here: https://github.com/mattt/sinatra-param#exceptions

The default behaviour returns a 400 response as soon as a param validations fails. If you set :raise_sinatra_param_exceptions, true you can rescue individual exceptions and append all messages to a variable, but I'm afraid it's a bit more difficult than this.

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

No branches or pull requests

2 participants