diff --git a/lib/async_hooks.js b/lib/async_hooks.js index e10a7e0edc06de..d5c7c116434c0b 100644 --- a/lib/async_hooks.js +++ b/lib/async_hooks.js @@ -368,6 +368,8 @@ function emitHookFactory(symbol, name) { restoreTmpHooks(); } }; + // Set the name property of the anonymous function as it looks good in the + // stack trace. Object.defineProperty(fn, 'name', { value: name });