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

Invalid query parameters cause internal server error #2291

Closed
KasperBrandt opened this issue Jul 5, 2016 · 1 comment
Closed

Invalid query parameters cause internal server error #2291

KasperBrandt opened this issue Jul 5, 2016 · 1 comment
Assignees
Milestone

Comments

@KasperBrandt
Copy link
Contributor

KasperBrandt commented Jul 5, 2016

  File "akvo/rest/filters.py", line 61, in filter_queryset
    queryset = getattr(queryset, param)(**args_or_kwargs)

In the new API filtering, you get an internal server error when the query is not correct, e.g.: http://rsr.akvo.org/rest/v1/project/?filter={'incorrect':'code'}.

We should catch this and return the error message in a dict with detail as key. E.g. {detail: 'Related Field got invalid lookup: incorrect'}

@damienallen
Copy link
Contributor

Test plan

Attempt API call with invalid filter. Error should now appear as "detail" in API view.

KasperBrandt added a commit that referenced this issue Jul 6, 2016
[#2291] Catch invalid API filters and pass error on to user
@MichaelAkvo MichaelAkvo added this to RSR Dec 8, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
Archived in project
Development

No branches or pull requests

2 participants