docs: documenting async hooks features#13287
Closed
AndreasMadsen wants to merge 18 commits into
Closed
Conversation
addaleax
approved these changes
May 29, 2017
Member
addaleax
left a comment
There was a problem hiding this comment.
LGTM modulo typos (if it helps I can fix them myself and push to this PR)
|
|
||
| If any `AsyncHook` callbacks throw, the application will print the stack trace | ||
| and exit. The exit path does follow that of an uncaught exception but | ||
| all `uncaughtException` listeners are removed, thus forceing the process to |
| If any `AsyncHook` callbacks throw, the application will print the stack trace | ||
| and exit. The exit path does follow that of an uncaught exception but | ||
| all `uncaughtException` listeners are removed, thus forceing the process to | ||
| exit. The `'exit'` callbacks will still call unless the application is run with |
|
|
||
| ##### Printing in AsyncHooks callbacks | ||
|
|
||
| Because printing to the console is an asynchronous operations `console.log()` |
| ##### Printing in AsyncHooks callbacks | ||
|
|
||
| Because printing to the console is an asynchronous operations `console.log()` | ||
| will cause the AsyncHooks callbacks to write. Using `console.log()` or similar |
|
|
||
| The `type` is a string that represents the type of resource that caused | ||
| `init()` to call. Generally it will be the name of the resource's constructor. | ||
| The resource types provided by the build in Node.js modules are: |
| the user's callback is placed in a `process.nextTick()`. | ||
|
|
||
| The graph only shows **when** a resource was created. Not **why**. So to track | ||
| the **why** use `triggerId`. |
Member
There was a problem hiding this comment.
typos: created. Not **why**. So to → created, not **why**, so to
| For example: | ||
|
|
||
| ```js | ||
| const server = net.createServer(conn => { |
Member
There was a problem hiding this comment.
I think we run the linter on docs now, so this might need to be (conn) instead of conn
| * Returns {undefined} | ||
|
|
||
| Call all `before()` callbacks and let them know a new asynchronous execution | ||
| context is being entered. If nested calls to `emitBefore()` are made the stack |
|
|
||
| * Returns {undefined} | ||
|
|
||
| Call all `after()` callbacks. If nested calls to `emitBefore()` were made then |
| make sure the stack is unwound properly. Otherwise an error will be thrown. | ||
|
|
||
| If the user's callback throws an exception then `emitAfter()` will | ||
| automatically be called for all `id`'s on the stack if the error is handled by |
Member
There was a problem hiding this comment.
remove the apostrophe (`id`'s → `id`s)
Member
Author
that would be awesome as I will go to bed soon. For minor things, I find this much more helpful. |
Checklist
Affected core subsystem(s)
This is a continuation on #12953 it should "fix" all the suggestions.
It took me 3 hours fix all the issues, so I would like if nits are done by you in a followup PR I simply don't have this much time. Also please be very specific with the suggestions, as in replace "this" with "this".