The dreaded "throwing after await"
See original GitHub issueThis might be completely expected, I’m not completely up-to-date on the state of node.js, but:
Repro steps
git clone https://github.com/fasterthanlime/async-test && cd async-test
npm i
npm start
Versions
$ node --version
v8.0.0
$ npm list
async-test@1.0.0 C:\msys64\home\amwenger\Dev\async-test
`-- trace@3.0.0
`-- stack-chain@1.3.7
Output
=================================
Throwing first thing
=================================
Full stack trace:
Error: throwing first thing
at cherrypie (C:\msys64\home\amwenger\Dev\async-test\index.js:12:13)
at binomial (C:\msys64\home\amwenger\Dev\async-test\index.js:14:40)
at abacus (C:\msys64\home\amwenger\Dev\async-test\index.js:15:38)
at main (C:\msys64\home\amwenger\Dev\async-test\index.js:16:22)
at Object.<anonymous> (C:\msys64\home\amwenger\Dev\async-test\index.js:34:1)
at Module._compile (module.js:569:30)
at Object.Module._extensions..js (module.js:580:10)
at Module.load (module.js:503:32)
at tryModuleLoad (module.js:466:12)
at Function.Module._load (module.js:458:3)
at Function.Module.runMain (module.js:605:10)
at startup (bootstrap_node.js:158:16)
at bootstrap_node.js:575:3
at <anonymous>
at checkStack (C:\msys64\home\amwenger\Dev\async-test\index.js:38:5)
at main (C:\msys64\home\amwenger\Dev\async-test\index.js:16:11)
at Object.<anonymous> (C:\msys64\home\amwenger\Dev\async-test\index.js:34:1)
at Module._compile (module.js:569:30)
at Object.Module._extensions..js (module.js:580:10)
at Module.load (module.js:503:32)
at tryModuleLoad (module.js:466:12)
at Function.Module._load (module.js:458:3)
at Function.Module.runMain (module.js:605:10)
at startup (bootstrap_node.js:158:16)
at bootstrap_node.js:575:3
=================================
Throwing after await
=================================
Full stack trace:
Error: after timeout
at cherrypie (C:\msys64\home\amwenger\Dev\async-test\index.js:26:13)
at <anonymous>
at <anonymous>
at checkStack (C:\msys64\home\amwenger\Dev\async-test\index.js:38:5)
at main (C:\msys64\home\amwenger\Dev\async-test\index.js:30:11)
at <anonymous>
at runMicrotasksCallback (internal/process/next_tick.js:86:5)
at _combinedTickCallback (internal/process/next_tick.js:95:7)
at process._tickCallback (internal/process/next_tick.js:161:9)
at Function.Module.runMain (module.js:607:11)
at startup (bootstrap_node.js:158:16)
at bootstrap_node.js:575:3
didn't see abacus, bailing
Expected output
In the second trace, something like:
<snip>
Error: after timeout
at cherrypie (C:\msys64\home\amwenger\Dev\async-test\index.js:26:13)
at binomial (path:line)
at abacus (path:line)
<snip>
Issue Analytics
- State:
- Created 6 years ago
- Reactions:2
- Comments:19 (10 by maintainers)
Top Results From Across the Web
5 Tips and Thoughts on Async / Await Functions
Simply put, you're throwing an error if it happens, but you're not 'catching' and responding to it. The solution? Treat the call to...
Read more >Why does exception still get thrown after catch in async ...
Because you're converting rejection to fulfillment with your catch handler. The await will await the promise returned by catch , which never ...
Read more >How to Throw Errors From Async Functions in JavaScript?
In the following post you'll learn: how to throw errors from async functions in JavaScript; how to test exception from async functions with ......
Read more >Practical Async/Await - Maxim Orlov
You're calling an asynchronous function and log the result: Calling an asynchronous getUser function and assigning the result to a user variable. Console ......
Read more >Error handling with Async/Await in JS | by Ian Segers | ITNEXT
This works as expected, we call the function thisThrows() which throws a regular error, we catch it, log the error and optionally we...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
They have subtle differences in the standard too. It is about how many rounds the microtask queue take.
Promise.resolve(1).then((val) => Promise.resolve(val)).then(...)
results in the same asPromise.resolve(1).then(...)
but they behave slightly differently.I know, but that was an issue I understood 😃
Hi there. I think I’ve solved this in #40. I’d love any feedback or testing anybody could give this code 😃
You can try it out by installing it from my repo: