From ab8fc67a311b957d6d97b5f273176b2bfdc00cf7 Mon Sep 17 00:00:00 2001 From: James M Snell Date: Mon, 15 Feb 2021 07:34:23 -0800 Subject: [PATCH] docs: clarify that async_hook callbacks cannot be async Signed-off-by: James M Snell --- doc/api/async_hooks.md | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/doc/api/async_hooks.md b/doc/api/async_hooks.md index 5f1d578beeb351..9e30f3481aa195 100644 --- a/doc/api/async_hooks.md +++ b/doc/api/async_hooks.md @@ -129,6 +129,10 @@ class MyAddedCallbacks extends MyAsyncCallbacks { const asyncHook = async_hooks.createHook(new MyAddedCallbacks()); ``` +Because promises are asynchronous resources whose lifecycle is tracked +via the async hooks mechanism, the `init()`, `before()`, `after()`, and +`destroy()` callbacks *must not* be async functions that return promises. + ##### Error handling If any `AsyncHook` callbacks throw, the application will print the stack trace