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

ArgumentError feedback should report the original offending value #104

Closed
ddnexus opened this issue Nov 13, 2018 · 2 comments
Closed

ArgumentError feedback should report the original offending value #104

ddnexus opened this issue Nov 13, 2018 · 2 comments
Labels

Comments

@ddnexus
Copy link
Owner

ddnexus commented Nov 13, 2018

The ArgumentError feedback should report the value of the original offending variable passed to the constructor.

Currently it reports the (possibly transformed by to_i) value of the instance variable. If you pass page: 'foo' then you should get an argument error saying expected :page in 1..23; got "foo" instead of expected :page in 1..23; got 0.

ddnexus added a commit that referenced this issue Nov 13, 2018
@ddnexus ddnexus closed this as completed Nov 13, 2018
@ddnexus ddnexus added the fixed label Nov 13, 2018
@archonic
Copy link
Contributor

Would it be possible to change the behaviour so it redirects to page=1? Users have to manually enter a wrong page value to get there, but I feel like a 500 is a bit harsh.

@ddnexus
Copy link
Owner Author

ddnexus commented Jul 14, 2019

With old versions you can rescue ArgumentError and check the message for the variable and the value.
With the new version you have Pagy::VariableError with the accessors for the offending variable and its value.
HTH

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants