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

Fixed #1314: yielding a function should not call the function #1315

Merged
merged 2 commits into from Jan 27, 2017

Conversation

@giltayar
Copy link
Contributor

@giltayar giltayar commented Jan 4, 2017

When rejecting a non-promise value, string.replace is used, and the value is passed as second parameter. But string.replace, if the second parameter is a function, will call that function.
This commit fixes this by using value.toString().

   When rejecting a non-promise value, string.replace is used,
    and the value is passed as second parameter.
    But string.replace, if the second value is a function, will
    call that function.
    This commit fixes this by using value.toString().
@@ -160,7 +160,8 @@ PromiseSpawn.prototype._continue = function (result) {
if (maybePromise === null) {
this._promiseRejected(
new TypeError(
YIELDED_NON_PROMISE_ERROR.replace("%s", value) +
YIELDED_NON_PROMISE_ERROR.replace("%s",
value == null ? value : value.toString()) +

This comment has been minimized.

@petkaantonov

petkaantonov Jan 4, 2017
Owner

value + "" is sufficient

@benjamingr
Copy link
Collaborator

@benjamingr benjamingr commented Jan 5, 2017

LGTM, @petkaantonov ?

@giltayar
Copy link
Contributor Author

@giltayar giltayar commented Jan 6, 2017

@benjamingr benjamingr merged commit 0566325 into petkaantonov:master Jan 27, 2017
1 check passed
1 check passed
continuous-integration/travis-ci/pr The Travis CI build passed
Details
@benjamingr
Copy link
Collaborator

@benjamingr benjamingr commented Jan 27, 2017

Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Linked issues

Successfully merging this pull request may close these issues.

None yet

3 participants