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

Handle empty first page in PagedDocuments #251

Open
nanotone opened this issue Mar 4, 2020 · 1 comment
Open

Handle empty first page in PagedDocuments #251

nanotone opened this issue Mar 4, 2020 · 1 comment

Comments

@nanotone
Copy link
Contributor

nanotone commented Mar 4, 2020

Sometimes in the response that PagedDocument gets from a FindPagedDocumentSeriesReferences request, the resulting first page is empty. This causes a NoMethodError when accessing the first document -- first_page.first ends up being nil.

There's probably a bigger question of why requests are being made for zero-document responses, but within this codebase it might be good to return early with something like

return {paging: nil, pages: 1, documents: []} if first_page.empty?

https://sentry.ds.va.gov/department-of-veterans-affairs/efolder/issues/8508/?referrer

@pkarman
Copy link
Contributor

pkarman commented Mar 4, 2020

I think we want to distinguish between zero pages and one page with no documents. We want to re-try if there are zero pages, so good to communicate that to the caller. Maybe with an exception?

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

No branches or pull requests

2 participants