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

wrong return value from BaseDocument#_getHookPromises (array of arrays of promise instead of array of promise) #57

Closed
royaltm opened this issue Feb 29, 2016 · 3 comments

Comments

@royaltm
Copy link

royaltm commented Feb 29, 2016

Long story short: this really ruined my night:

hookPromises.push(_.invoke([this], hookName));

The typeless at its worst...

this will push an array with (a possible) promise into an array

hookPromises.push(_.invoke([this], hookName));

resulting in [[promise]] instead of [promise]

and this is bad, because
Promise.all([[promise]]) immediately succeeds.

So any error in ANY of this document hook's promise will be (possible silently) discarded!

why just not

hookPromises.push(this[hookName]());

or at least:

hookPromises = hookPromises.concat(_.invoke([this], hookName));
@royaltm royaltm changed the title wrong return value in BaseDocument#_getHookPromises (array of arrays of promise instead of array of promise) wrong return value from BaseDocument#_getHookPromises (array of arrays of promise instead of array of promise) Feb 29, 2016
@scottwrobinson
Copy link
Owner

Thanks for bringing this up. I should be able to try out your fix tomorrow.

Thanks!

@scottwrobinson
Copy link
Owner

Also, if you can post any code that shows the error that would be great. Thanks!

@royaltm
Copy link
Author

royaltm commented Feb 29, 2016

here you go

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

2 participants