Episode VI: Return of the Promise PRs (getPage Promise support)#434
Merged
kaizensoze merged 3 commits intooctokit:masterfrom Oct 10, 2016
jamsinclair:fix-get-page-promises
Merged
Episode VI: Return of the Promise PRs (getPage Promise support)#434kaizensoze merged 3 commits intooctokit:masterfrom jamsinclair:fix-get-page-promises
kaizensoze merged 3 commits intooctokit:masterfrom
jamsinclair:fix-get-page-promises
Conversation
jamsinclair
commented
Oct 10, 2016
| return callback(new error.NotFound("No " + which + " page found")); | ||
| if (!url) { | ||
| var urlErr = new error.NotFound("No " + which + " page found"); | ||
| return self.Promise && !callback ? self.Promise.reject(urlErr) : callback(urlErr); |
Author
There was a problem hiding this comment.
Worth throwing an error if neither promise or callback defined, like below?
There was a problem hiding this comment.
Up to you. Not a dealbreaker without it.
Author
There was a problem hiding this comment.
I'll leave it be 😄 , I'm sure my lazy developer habits will come back to haunt me.
|
This looks good. I'll add the example output to the examples section. As a bonus, how much work would it be to get the promise stuff also compatible with Q? If a significant amount I'll just go ahead and merge this. |
Author
|
From a quick 5 minute play, it seems like the Q library is compatible. I've commented in the issue #400 😄 If you're fine with the PR, happy for you to merge 👍 |
|
Awesome. Good to go. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Was hesitant to re-open the issue you just closed #425. I had a similar situation where I was trying to retrieve a large number or all records via paging and promises.
This PR follows in the footsteps of #262 and adds pluggable promise support to all
getPagebased methods.Not as nice as I would've liked. Most of it is duplicated code taken from the #262 solution.
Example outcome from PR:
If this is not at all how you would like it approached feel free to close this PR, as not to waste your time 😸. Very happy to make changes.
Edit: Tidied up example code.