| 598 | const continuationWindow = this.#continuationWindow; |
| 599 | |
| 600 | function wrappedCallback(err, res) { |
| 601 | if (err) { |
| 602 | context.error = err; |
| 603 | error.publish(context); |
| 604 | } else { |
| 605 | context.result = res; |
| 606 | } |
| 607 | |
| 608 | // Use continuation window for asyncStart/asyncEnd around callback |
| 609 | // eslint-disable-next-line no-unused-vars |
| 610 | using scope = continuationWindow.withScope(context); |
| 611 | return ReflectApply(callback, this, arguments); |
| 612 | } |
| 613 | |
| 614 | const callback = ArrayPrototypeAt(args, position); |
| 615 | validateFunction(callback, 'callback'); |