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

Pagination.current is sometimes nil #40

Open
CloCkWeRX opened this issue Mar 22, 2016 · 0 comments
Open

Pagination.current is sometimes nil #40

CloCkWeRX opened this issue Mar 22, 2016 · 0 comments

Comments

@CloCkWeRX
Copy link

https://da.kiama.nsw.gov.au/atdis/1.0/applications.json?lodgement_date_end=2016-03-22&lodgement_date_start=2016-02-21&page=6

produces

{"response":[],"count":0,"pagination":null}

While I'm not sure if thats conforming or not to the spec; it means that consuming code fails with:

/app/vendor/bundle/ruby/2.0.0/bundler/gems/atdisplanningalertsfeed-ce20de6801cf/lib/atdisplanningalertsfeed.rb:22:in `save_page' : undefined method `current' for nil:NilClass (NoMethodError)
    from /app/vendor/bundle/ruby/2.0.0/bundler/gems/atdisplanningalertsfeed-ce20de6801cf/lib/atdisplanningalertsfeed.rb:17:in `save'
    from scraper.rb:6:in `<main>'

and you have to wrap all of your calls to

page.pagination.current

in

page.pagination.current if page.pagination

It would be better for this to never be nil, but a valid pagination object with defaults.

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

1 participant