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

Searching with invalid dkist.PageSize could handle 422 better and return details #306

Open
JimArnow-nso opened this issue Oct 18, 2023 · 0 comments
Labels

Comments

@JimArnow-nso
Copy link

Fido.search(a.dkist.Page(page=1), a.dkist.PageSize(1001))

throws

HTTPError: HTTP Error 422: Unprocessable Entity

but does not give any details of what failed. Meanwhile, under the hood, the GET is equivalent to this direct curl:

https://api.dkistdc.nso.edu/datasets/v1?pageNumber=1&pageSize=1001&sortColumn=createDate

which returns a 422 but also includes this in the response body:

{"detail":[{"loc":["query","pageSize"],"msg":"ensure this value is less than or equal to 1000","type":"value_error.number.not_le","ctx":{"limit_value":1000}}]}

Displaying some of the details from the response could be useful to the user.

It is possible to check for possible values before making the GET, but that is dependent on adding support for the searchValues API (see #167) and adding pageSize to the list of parameter values that searchValues returns.

@JimArnow-nso JimArnow-nso changed the title Searching with invalid dkist.PageSize could handle 422 better and return Searching with invalid dkist.PageSize could handle 422 better and return details Oct 18, 2023
@Cadair Cadair added the bug label Oct 20, 2023
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