node-restify
node-restify copied to clipboard
stop handling `then` when `next` is called
Pre-Submission Checklist
- [v] Opened an issue discussing these changes before opening the PR
- [v] Ran the linter and tests via
make prepush - [v] Included comprehensive and convincing tests for changes
Issues
Closes:
- Issue #1935
Summarize the issues that discussed these changes
currently, the async function handling does not meet user's expectation. a function returning Promise can still have the next param and:
- it could get called twice.
- if user send out an error through the next, the promise could still resolve.
Changes
add a local variable to check whether next is called and wrap the next function.
What does this PR do?
- in
chain.jsprevent further Promise handling if next is called. - add tests
Hi @mmarchini, could you review this PR when you have time?