async_hooks: async hook stack assertion shadows "Maximum call stack size exceeded"
- Node Version:
v8.2.1 - Platform:
Linux 4.10.0-33-generic #37~16.04.1-Ubuntu SMP Fri Aug 11 14:07:24 UTC 2017 x86_64 x86_64 x86_64 GNU/Linux - node-fetch@1.7.3
My product is not affected by this bug, but I report it anyway because it's still a bug and may affect someone else.
'use strict'; const fetch = require('node-fetch'); // Function name `fetch` clashes with required `fetch`! const FooBar = async function fetch(url, encoding) { const res = fetch(url); // Programmer forgot `await` here! const text = await res.text(); }; (async function () { return await FooBar('https://github.com'); })();
$ node foobar.js Error: async hook stack has become corrupted (actual: 0, expected: 1) 1: node::Start(uv_loop_s*, int, char const* const*, int, char const* const*) [node] 2: node::Start(int, char**) [node] 3: __libc_start_main [/lib/x86_64-linux-gnu/libc.so.6] 4: 0x8ec861 [node]
Expected
User-friendly error message is expected, not this stack error.