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 Null Comments Result #1039

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

devinlyons
Copy link

This was causing issues with one of my repos. This seems to have fixed it.

@devinlyons
Copy link
Author

If this gets merged, what would it take to get a new release? I would like to update https://github.com/github-changelog-generator/docker-github-changelog-generator too.

@olleolleolle
Copy link
Collaborator

@devinlyons I can see that this would fix that issue, can you figure out a test case that could go in the repo, too?

@devinlyons
Copy link
Author

@olleolleolle, my Ruby skills are a bit weak. But I did look through the tests to see if I could find an example to work from. It looks like the fetch_comments_async function is only ever mocked in the tests. I guess this makes sense given that it does a lot of IO. So, I'm not sure how to test this. The use case is something like it does not throw an exception when a page returns no comments. Do you have any guidance on this?

@olleolleolle
Copy link
Collaborator

olleolleolle commented Feb 9, 2024

I took a look at the yield which this conditional is protecting from.

Was curious if the #iterate_pages could be made so that it didn't yield if it got a nil last_response.data (which is used in yield(last_response.data)) in #iterate_pages.

# @yield [Sawyer::Resource] An OctoKit-provided response (which can be empty)

I also couldn't see a quick way to test-drive that thing.

(This morning it dawned on me, "perhaps the data is never there, after some API change?")

@devinlyons
Copy link
Author

@olleolleolle, I updated the function so it should never yield null.

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

Successfully merging this pull request may close these issues.

None yet

2 participants