Closed Ivo-Balbaert closed 3 years ago
This issue is fixed, for some reason Gitbook was building the old documentation source files.
After installing Clio 0.8.2 , creating a new project and copying the code from the async/await example in a project, I still get the same error in Windows 10:
D:\Clio\own_projects\async1>clio run Info: Compiling from "clio.toml" Info: Creating build for target "js" √ Compiling source... √ Adding Clio start script... √ Installing npm dependencies (this may take a while)...
@ start D:\Clio\own_projects\async1\build node .clio/index.js
(node:10332) UnhandledPromiseRejectionWarning: ReferenceError: fetch is not defined
at D:\Clio\own_projects\async1\build\main.clio.js:1:187
at run (D:\Clio\own_projects\async1\build\node_modules\clio-run\src\index.js:106:26)
at async D:\Clio\own_projects\async1\build\node_modules\clio-run\src\runners\wt.js:32:5
(Use node --trace-warnings ...
to show where the warning was created)
(node:10332) 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: 2)
(node:10332) [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.
All async/await programs: On Playground give the error: [TypeError: Failed to fetch]
(node:10332) UnhandledPromiseRejectionWarning: ReferenceError: fetch is not defined
I forgot the fact that fetch
is browser only and the example does not run in node without first installing and importing node-fetch
. I'll update the documentation, maybe come up with another async / await example.
Describe the bug All examples in async/await have either runtime or compilation issues:
Example 1: Windows 10: error: (node:8404) UnhandledPromiseRejectionWarning: ReferenceError: fetch is not defined at D:\Clio\own_projects\await1\build\main.clio.js:1:187 -- at run (D:\Clio\own_projects\await\build\node\node_modules\clio-run\src\index.js:106:26) -- at async D:\Clio\own_projects\await\build\node\node_modules\clio-run\src\runners\wt.js:32:5 -- (Use
node --trace-warnings ...
to show where the warning was created) -- (node:1056) 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: 2) -- (node:1056) [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. -- <-- This process hangs-- Output should be: -- {"organization_name":"Telenet BVBA","region":"Flanders","accuracy":5,"asn":6848,"organization":"AS6848 Telenet BVBA","timezone":"Europe\/Brussels","longitude":"4.4487","country_code3":"BEL","area_code":"0","ip":"81.83.67.231","city":"Mortsel","country":"Belgium","continent_code":"EU","country_code":"BE","latitude":"51.1662"}
[TypeError: Failed to fetch] ← probably same error
Example 2: await outside of flow
Example 3: await block:
Expecting one of lineBreak, conditional, fullConditional, function, symbol, parameter, number, array, string, formattedString, hashmap, propertyAccess, range, rangeFull, rangeBy, byRange, ranger, slice, set, wrapped, awaited, parallelFn, null, true, false, inCheck, group, assignment, arrowAssignment, math, comparison, logical, logicalNot, call, imported, outdent but encountered colon
Example 4: await [] same error as Example 3 Example 5: await keyword: same error as Example 3
To Reproduce Steps to reproduce the behavior:
Expected behavior json outputs of the fetch commands
Screenshots If applicable, add screenshots to help explain your problem.
Versions (please complete the following information):
Possible solutions
If fix is not evident, either remove the section (temporarily) or write a header: WIP: In the current version 0.8.1 these code examples don't work
Additional context It was mention on Telegram that it would be fixed in v0.8, but it isn't