Skip to content

asyncjs: add then, catch for promise pipelining#16871

Merged
Araq merged 8 commits intonim-lang:develfrom
timotheecour:pr_asyncjs_then_catch
Feb 24, 2021
Merged

asyncjs: add then, catch for promise pipelining#16871
Araq merged 8 commits intonim-lang:develfrom
timotheecour:pr_asyncjs_then_catch

Conversation

@timotheecour
Copy link
Copy Markdown
Member

@timotheecour timotheecour commented Jan 30, 2021

prerequisite for things like jsfetch #12531

note

with this flag, for nodejs < 15.0.0 (all except freebsd CI), you'd get exit code 0 and this message:

(Use node --trace-warnings ... to show where the warning was created)
(node:72796) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). To terminate the node process on unhandled promise rejection, use the CLI flag --unhandled-rejections=strict (see https://nodejs.org/api/cli.html#cli_unhandled_rejections_mode). (rejection id: 3)
(node:72796) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.

links

https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Promise/catch etc

future work

nim r -b:js --lib:lib -d:nodejs --passnode:--unhandled-rejections=strict tests/js/tasyncjs_fail.nim

after which i can mark expected exitcode as != 0 for tests/js/tasyncjs_fail.nim

it'd be handled here: in compiler/nim.nim near execExternalProgram(conf, cmdPrefix & output.quoteShell & ' ' & conf.arguments)

@timotheecour timotheecour marked this pull request as draft January 30, 2021 05:00
@juancarlospaco
Copy link
Copy Markdown
Collaborator

Changelog.

@juancarlospaco
Copy link
Copy Markdown
Collaborator

juancarlospaco commented Feb 16, 2021

@timotheecour Approx ETA ?, is doable?, is needed for #12531 🙂

@timotheecour
Copy link
Copy Markdown
Member Author

@juancarlospaco ok, getting back to this, thanks for the ping...

@juancarlospaco
Copy link
Copy Markdown
Collaborator

...was just asking, but Ok 🙂

@timotheecour
Copy link
Copy Markdown
Member Author

@juancarlospaco PTAL

Changelog.

also, IMO it's better usually to add review comments in the file view instead of the main PR thread so they remain threaded and so I can mark each of them as individually resolved; maybe except for important comments that should garner more attention from other reviewers

@timotheecour timotheecour marked this pull request as ready for review February 18, 2021 04:32
@timotheecour
Copy link
Copy Markdown
Member Author

timotheecour commented Feb 18, 2021

how come CI didn't run in azure?
EDIT: i restarted CI

@timotheecour timotheecour reopened this Feb 18, 2021
@timotheecour timotheecour changed the title asyncjs: add then, catch asyncjs: add then, catch for promise pipelining Feb 18, 2021
@timotheecour
Copy link
Copy Markdown
Member Author

ping @xflywind to unblock jsfetch #12531

@timotheecour timotheecour added the TODO: followup needed remove tag once fixed or tracked elsewhere label Feb 24, 2021
@Araq Araq merged commit a4e6b24 into nim-lang:devel Feb 24, 2021
@timotheecour timotheecour deleted the pr_asyncjs_then_catch branch February 24, 2021 20:31
timotheecour added a commit to timotheecour/Nim that referenced this pull request Feb 25, 2021
timotheecour added a commit to timotheecour/Nim that referenced this pull request Feb 26, 2021
timotheecour added a commit to timotheecour/Nim that referenced this pull request Mar 4, 2021
Araq pushed a commit that referenced this pull request Mar 4, 2021
#17189)

* followup #16871 asyncjs.then: allow pipelining procs returning futures
* rename test files where they belong
* fix tests
* tests for then with `onReject` callback
* rename test file containing fail to avoid messing with grep
* address comments
* cleanup
* un-disable 1 test
ringabout pushed a commit to ringabout/Nim that referenced this pull request Mar 22, 2021
* asyncjs: add then
* improve tests, changelog, API
* fix cryptic windows error: The parameter is incorrect
* address comments
ringabout pushed a commit to ringabout/Nim that referenced this pull request Mar 22, 2021
…g futures (nim-lang#17189)

* followup nim-lang#16871 asyncjs.then: allow pipelining procs returning futures
* rename test files where they belong
* fix tests
* tests for then with `onReject` callback
* rename test file containing fail to avoid messing with grep
* address comments
* cleanup
* un-disable 1 test
ardek66 pushed a commit to ardek66/Nim that referenced this pull request Mar 26, 2021
* asyncjs: add then
* improve tests, changelog, API
* fix cryptic windows error: The parameter is incorrect
* address comments
ardek66 pushed a commit to ardek66/Nim that referenced this pull request Mar 26, 2021
…g futures (nim-lang#17189)

* followup nim-lang#16871 asyncjs.then: allow pipelining procs returning futures
* rename test files where they belong
* fix tests
* tests for then with `onReject` callback
* rename test file containing fail to avoid messing with grep
* address comments
* cleanup
* un-disable 1 test
@metagn metagn removed the TODO: followup needed remove tag once fixed or tracked elsewhere label Jan 4, 2024
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

Successfully merging this pull request may close these issues.

5 participants