Fix error handling in Deferred's promise functions#191
Merged
particlebanana merged 1 commit intobalderdashy:masterfrom Dec 19, 2013
Merged
Fix error handling in Deferred's promise functions#191particlebanana merged 1 commit intobalderdashy:masterfrom
particlebanana merged 1 commit intobalderdashy:masterfrom
Conversation
Contributor
|
I would love to see this merged in. Right now I end up using |
With Q promises, if the then(), fail() or spread() handlers throw an exception, the promise is rejected. The wrapper functions in Deferred, however, were simply throwing those exceptions on up. Rather than try to duplicate those functions in waterline, this patch adds a toPromise() method to Deferred which simply executes the query and creates a Q Promise with the result. Then then(), fail() and spread() functions are then just wrappers calling those methods on the Promise.
particlebanana
added a commit
that referenced
this pull request
Dec 19, 2013
Fix error handling in Deferred's promise functions
Contributor
|
Thanks, I'm not a user of promises so thanks for the updates guys! |
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.
With Q promises, if the then(), fail() or spread() handlers throw an
exception, the promise is rejected. The wrapper functions in Deferred,
however, were simply throwing those exceptions on up.
Rather than try to duplicate those functions in waterline, this patch
adds a toPromise() method to Deferred which simply executes the query
and creates a Q Promise with the result. Then then(), fail() and
spread() functions are then just wrappers calling those methods on the
Promise.