-
-
Notifications
You must be signed in to change notification settings - Fork 1.5k
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
asyncjs: add then
, catch
for promise pipelining
#16871
Conversation
Changelog. |
@timotheecour Approx ETA ?, is doable?, is needed for #12531 🙂 |
@juancarlospaco ok, getting back to this, thanks for the ping... |
...was just asking, but Ok 🙂 |
349b1be
to
306c930
Compare
@juancarlospaco PTAL
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 |
how come CI didn't run in azure? |
then
, catch
then
, catch
for promise pipelining
225e3a7
to
43f0f82
Compare
* asyncjs: add then * improve tests, changelog, API * fix cryptic windows error: The parameter is incorrect * address comments
…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
* asyncjs: add then * improve tests, changelog, API * fix cryptic windows error: The parameter is incorrect * address comments
…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
prerequisite for things like
jsfetch
#12531note
--unhandled-rejections=strict
node flag is now passed in testament for nodejs tests, so thattests/js/tasyncjs_fail.nim
returns exit code != 0 (and so that this test succeeds). This flag is explained in https://nodejs.org/api/cli.html#cli_unhandled_rejections_mode and is the default starting with node >= 15.0.0with 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.
I'm hiding the new API under
nimExperimentalAsyncjsThen
, refsnimExperimentalFoo
for experimental modules/APIs timotheecour/Nim#575I'm using this pattern cross reference comments via a GUID-like pattern, eg:
D20210217T221607
timotheecour/Nim#596 for cross referencing an explanationlinks
https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Promise/catch etc
future work
=> upgrade nodejs; add nimCiSystemInfo on azure/github CI #18003
--passnode
maybe), which we'd use as follows: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)