Commit 49f16d7
async_wrap: allow some hooks to be optional
Only enforce that the init callback is passed to setupHooks(). The
remaining hooks can be optionally passed.
Throw if async_wrap.enable() runs before setting the init callback or if
setupHooks() is called while async wrap is enabled.
Add test to verify calls throw appropriately.
PR-URL: #3461
Reviewed-By: Fedor Indutny <fedor@indutny.com>1 parent f413fae commit 49f16d7Copy full SHA for 49f16d7
File tree
Expand file treeCollapse file tree
2 files changed
+35
-5
lines changedOpen diff view settings
Filter options
- src
- test/parallel
Expand file treeCollapse file tree
2 files changed
+35
-5
lines changedOpen diff view settings
Collapse file
+13-5Lines changed: 13 additions & 5 deletions
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| ||
103 | 103 | |
104 | 104 | |
105 | 105 | |
| 106 | + |
| 107 | + |
| 108 | + |
106 | 109 | |
107 | 110 | |
108 | 111 | |
| ||
116 | 119 | |
117 | 120 | |
118 | 121 | |
119 | | - |
120 | | - |
121 | | - |
| 122 | + |
| 123 | + |
| 124 | + |
| 125 | + |
| 126 | + |
122 | 127 | |
123 | 128 | |
124 | | - |
125 | | - |
| 129 | + |
| 130 | + |
| 131 | + |
| 132 | + |
| 133 | + |
126 | 134 | |
127 | 135 | |
128 | 136 | |
|
Collapse file
test/parallel/test-async-wrap-throw-no-init.js
Copy file name to clipboard+22Lines changed: 22 additions & 0 deletions
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| ||
| 1 | + |
| 2 | + |
| 3 | + |
| 4 | + |
| 5 | + |
| 6 | + |
| 7 | + |
| 8 | + |
| 9 | + |
| 10 | + |
| 11 | + |
| 12 | + |
| 13 | + |
| 14 | + |
| 15 | + |
| 16 | + |
| 17 | + |
| 18 | + |
| 19 | + |
| 20 | + |
| 21 | + |
| 22 | + |
0 commit comments