Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/nodejs/node.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJames M Snell <jasnell@gmail.com>2021-02-15 18:34:23 +0300
committerZiJian Liu <Lxxyxzj@gmail.com>2021-02-18 13:46:17 +0300
commitbb35b6efa6cf218809dba6219ebd2168f4de6559 (patch)
treee696f43d7367ab8f85a7297bff95d73168a15970 /doc/api/async_hooks.md
parent9a2ac2c615b435effe5d86e786aef2add00b13d2 (diff)
doc: clarify that async_hook callbacks cannot be async
Signed-off-by: James M Snell <jasnell@gmail.com> PR-URL: https://github.com/nodejs/node/pull/37384 Reviewed-By: Michaël Zasso <targos@protonmail.com> Reviewed-By: Luigi Pinca <luigipinca@gmail.com> Reviewed-By: Darshan Sen <raisinten@gmail.com> Reviewed-By: Zijian Liu <lxxyxzj@gmail.com> Reviewed-By: Gerhard Stöbich <deb2001-github@yahoo.de>
Diffstat (limited to 'doc/api/async_hooks.md')
-rw-r--r--doc/api/async_hooks.md4
1 files changed, 4 insertions, 0 deletions
diff --git a/doc/api/async_hooks.md b/doc/api/async_hooks.md
index 5f1d578beeb..9e30f3481aa 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