Commit 5b92eb4
src: refactor uncaught exception handling
The C++ land `node::FatalException()` is not in fact fatal anymore.
It gives the user a chance to handle the uncaught exception
globally by listening to the `uncaughtException` event. This patch
renames it to `TriggerUncaughtException` in C++ to avoid the confusion.
In addition rename the JS land handler to `onGlobalUncaughtException`
to reflect its purpose - we have to keep the alias
`process._fatalException` and use that for now since it has been
monkey-patchable in the user land.
This patch also
- Adds more comments to the global uncaught exception handling routine
- Puts a few other C++ error handling functions into the `errors`
namespace
- Moves error-handling-related bindings to the `errors` binding.
Refs: 2b252ac
PR-URL: #28257
Reviewed-By: Anna Henningsen <anna@addaleax.net>
Reviewed-By: Benjamin Gruenbaum <benjamingr@gmail.com>
Reviewed-By: Franziska Hinkelmann <franziska.hinkelmann@gmail.com>1 parent b6a7052 commit 5b92eb4Copy full SHA for 5b92eb4
File tree
Expand file treeCollapse file tree
16 files changed
+190
-158
lines changedOpen diff view settings
Filter options
- lib/internal
- bootstrap
- main
- modules/cjs
- process
- src
- api
Expand file treeCollapse file tree
16 files changed
+190
-158
lines changedOpen diff view settings
Collapse file
lib/internal/bootstrap/node.js
Copy file name to clipboardExpand all lines: lib/internal/bootstrap/node.js+8-2Lines changed: 8 additions & 2 deletions
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| ||
254 | 254 | |
255 | 255 | |
256 | 256 | |
257 | | - |
| 257 | + |
258 | 258 | |
259 | 259 | |
260 | 260 | |
261 | 261 | |
262 | | - |
| 262 | + |
| 263 | + |
| 264 | + |
| 265 | + |
| 266 | + |
| 267 | + |
| 268 | + |
263 | 269 | |
264 | 270 | |
265 | 271 | |
|
Collapse file
lib/internal/main/worker_thread.js
Copy file name to clipboardExpand all lines: lib/internal/main/worker_thread.js+13-10Lines changed: 13 additions & 10 deletions
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| ||
42 | 42 | |
43 | 43 | |
44 | 44 | |
45 | | - |
| 45 | + |
46 | 46 | |
47 | 47 | |
48 | 48 | |
| ||
151 | 151 | |
152 | 152 | |
153 | 153 | |
154 | | - |
155 | | - |
156 | | - |
157 | | - |
| 154 | + |
| 155 | + |
| 156 | + |
158 | 157 | |
159 | | - |
| 158 | + |
160 | 159 | |
161 | 160 | |
162 | 161 | |
163 | | - |
| 162 | + |
164 | 163 | |
165 | | - |
| 164 | + |
166 | 165 | |
167 | 166 | |
168 | 167 | |
169 | 168 | |
170 | 169 | |
171 | | - |
| 170 | + |
172 | 171 | |
173 | 172 | |
174 | 173 | |
| ||
182 | 181 | |
183 | 182 | |
184 | 183 | |
185 | | - |
| 184 | + |
| 185 | + |
| 186 | + |
| 187 | + |
| 188 | + |
186 | 189 | |
187 | 190 | |
188 | 191 | |
|
Collapse file
lib/internal/modules/cjs/loader.js
Copy file name to clipboardExpand all lines: lib/internal/modules/cjs/loader.js+1-1Lines changed: 1 addition & 1 deletion
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| ||
829 | 829 | |
830 | 830 | |
831 | 831 | |
832 | | - |
| 832 | + |
833 | 833 | |
834 | 834 | |
835 | 835 | |
|
Collapse file
lib/internal/process/execution.js
Copy file name to clipboardExpand all lines: lib/internal/process/execution.js+9-5Lines changed: 9 additions & 5 deletions
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| ||
115 | 115 | |
116 | 116 | |
117 | 117 | |
118 | | - |
119 | | - |
120 | | - |
121 | | - |
| 118 | + |
| 119 | + |
| 120 | + |
| 121 | + |
| 122 | + |
| 123 | + |
| 124 | + |
| 125 | + |
122 | 126 | |
123 | 127 | |
124 | 128 | |
| ||
206 | 210 | |
207 | 211 | |
208 | 212 | |
209 | | - |
| 213 | + |
210 | 214 | |
211 | 215 | |
212 | 216 | |
Collapse file
lib/internal/process/promises.js
Copy file name to clipboardExpand all lines: lib/internal/process/promises.js+24-24Lines changed: 24 additions & 24 deletions
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| ||
2 | 2 | |
3 | 3 | |
4 | 4 | |
5 | | - |
6 | | - |
7 | | - |
8 | 5 | |
9 | 6 | |
10 | 7 | |
| ||
13 | 10 | |
14 | 11 | |
15 | 12 | |
16 | | - |
17 | | - |
| 13 | + |
18 | 14 | |
19 | 15 | |
| 16 | + |
| 17 | + |
| 18 | + |
| 19 | + |
| 20 | + |
20 | 21 | |
21 | 22 | |
22 | 23 | |
| ||
127 | 128 | |
128 | 129 | |
129 | 130 | |
130 | | - |
| 131 | + |
131 | 132 | |
132 | 133 | |
133 | 134 | |
| ||
139 | 140 | |
140 | 141 | |
141 | 142 | |
142 | | - |
| 143 | + |
| 144 | + |
143 | 145 | |
144 | 146 | |
145 | 147 | |
| ||
179 | 181 | |
180 | 182 | |
181 | 183 | |
182 | | - |
| 184 | + |
| 185 | + |
| 186 | + |
183 | 187 | |
184 | 188 | |
185 | 189 | |
| ||
209 | 213 | |
210 | 214 | |
211 | 215 | |
212 | | - |
| 216 | + |
213 | 217 | |
214 | 218 | |
215 | 219 | |
| ||
225 | 229 | |
226 | 230 | |
227 | 231 | |
228 | | - |
229 | | - |
230 | | - |
231 | | - |
232 | | - |
233 | | - |
234 | | - |
235 | | - |
236 | | - |
237 | | - |
238 | | - |
239 | | - |
240 | | - |
241 | | - |
242 | | - |
| 232 | + |
| 233 | + |
| 234 | + |
| 235 | + |
| 236 | + |
| 237 | + |
| 238 | + |
| 239 | + |
| 240 | + |
| 241 | + |
| 242 | + |
243 | 243 | |
244 | 244 | |
245 | 245 | |
|
Collapse file
lib/internal/process/task_queues.js
Copy file name to clipboardExpand all lines: lib/internal/process/task_queues.js+8-7Lines changed: 8 additions & 7 deletions
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| ||
9 | 9 | |
10 | 10 | |
11 | 11 | |
12 | | - |
13 | | - |
| 12 | + |
14 | 13 | |
15 | 14 | |
| 15 | + |
| 16 | + |
| 17 | + |
| 18 | + |
16 | 19 | |
17 | 20 | |
18 | 21 | |
| ||
143 | 146 | |
144 | 147 | |
145 | 148 | |
146 | | - |
147 | | - |
148 | | - |
149 | | - |
150 | | - |
| 149 | + |
| 150 | + |
| 151 | + |
151 | 152 | |
152 | 153 | |
153 | 154 | |
|
Collapse file
+5-10Lines changed: 5 additions & 10 deletions
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| ||
244 | 244 | |
245 | 245 | |
246 | 246 | |
| 247 | + |
| 248 | + |
| 249 | + |
| 250 | + |
247 | 251 | |
248 | | - |
249 | | - |
250 | | - |
251 | | - |
252 | | - |
253 | | - |
254 | | - |
255 | | - |
256 | | - |
257 | | - |
| 252 | + |
258 | 253 | |
259 | 254 | |
260 | 255 | |
Collapse file
+1-1Lines changed: 1 addition & 1 deletion
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| ||
666 | 666 | |
667 | 667 | |
668 | 668 | |
669 | | - |
| 669 | + |
670 | 670 | |
671 | 671 | |
672 | 672 | |
|
Collapse file
+5-5Lines changed: 5 additions & 5 deletions
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| ||
49 | 49 | |
50 | 50 | |
51 | 51 | |
52 | | - |
| 52 | + |
53 | 53 | |
54 | 54 | |
55 | 55 | |
| ||
65 | 65 | |
66 | 66 | |
67 | 67 | |
68 | | - |
| 68 | + |
69 | 69 | |
70 | 70 | |
71 | 71 | |
| ||
80 | 80 | |
81 | 81 | |
82 | 82 | |
83 | | - |
| 83 | + |
84 | 84 | |
85 | 85 | |
86 | 86 | |
| ||
102 | 102 | |
103 | 103 | |
104 | 104 | |
105 | | - |
| 105 | + |
106 | 106 | |
107 | 107 | |
108 | 108 | |
| ||
137 | 137 | |
138 | 138 | |
139 | 139 | |
140 | | - |
| 140 | + |
141 | 141 | |
142 | 142 | |
143 | 143 | |
|
Collapse file
+3-5Lines changed: 3 additions & 5 deletions
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| ||
121 | 121 | |
122 | 122 | |
123 | 123 | |
124 | | - |
125 | 124 | |
126 | 125 | |
127 | 126 | |
| ||
212 | 211 | |
213 | 212 | |
214 | 213 | |
215 | | - |
216 | | - |
217 | | - |
218 | | - |
| 214 | + |
| 215 | + |
| 216 | + |
219 | 217 | |
220 | 218 | |
221 | 219 | |
|
0 commit comments