@@ -314,24 +314,24 @@ function tryOnTimeout(timer, list) { |
314 | 314 | } |
315 | 315 | } |
316 | 316 |
|
317 | | - if (!threw) return; |
318 | | - |
319 | | - // Postpone all later list events to next tick. We need to do this |
320 | | - // so that the events are called in the order they were created. |
321 | | - const lists = list._unrefed === true ? unrefedLists : refedLists; |
322 | | - for (var key in lists) { |
323 | | - if (key > list.msecs) { |
324 | | - lists[key].nextTick = true; |
| 317 | + if (threw) { |
| 318 | + // Postpone all later list events to next tick. We need to do this |
| 319 | + // so that the events are called in the order they were created. |
| 320 | + const lists = list._unrefed === true ? unrefedLists : refedLists; |
| 321 | + for (var key in lists) { |
| 322 | + if (key > list.msecs) { |
| 323 | + lists[key].nextTick = true; |
| 324 | + } |
325 | 325 | } |
| 326 | + // We need to continue processing after domain error handling |
| 327 | + // is complete, but not by using whatever domain was left over |
| 328 | + // when the timeout threw its exception. |
| 329 | + const domain = process.domain; |
| 330 | + process.domain = null; |
| 331 | + // If we threw, we need to process the rest of the list in nextTick. |
| 332 | + process.nextTick(listOnTimeoutNT, list); |
| 333 | + process.domain = domain; |
326 | 334 | } |
327 | | - // We need to continue processing after domain error handling |
328 | | - // is complete, but not by using whatever domain was left over |
329 | | - // when the timeout threw its exception. |
330 | | - const domain = process.domain; |
331 | | - process.domain = null; |
332 | | - // If we threw, we need to process the rest of the list in nextTick. |
333 | | - process.nextTick(listOnTimeoutNT, list); |
334 | | - process.domain = domain; |
335 | 335 | } |
336 | 336 | } |
337 | 337 |
|
|