MCPcopy Index your code
hub / github.com/nodejs/node / makeRunHook

Function makeRunHook

lib/internal/promise_hooks.js:44–64  ·  view source on GitHub ↗
(list)

Source from the content-addressed store, hash-verified

42}
43
44function makeRunHook(list) {
45 return (promise) => {
46 const hookSet = ArrayPrototypeSlice(list);
47 const exceptions = [];
48
49 for (let i = 0; i < hookSet.length; i++) {
50 const hook = hookSet[i];
51 try {
52 hook(promise);
53 } catch (err) {
54 ArrayPrototypePush(exceptions, err);
55 }
56 }
57
58 // Triggering exceptions is deferred to allow other hooks to complete
59 for (let i = 0; i < exceptions.length; i++) {
60 const err = exceptions[i];
61 triggerUncaughtException(err, false);
62 }
63 };
64}
65
66const beforeAll = makeRunHook(hooks.before);
67const afterAll = makeRunHook(hooks.after);

Callers 1

promise_hooks.jsFile · 0.85

Calls 1

hookFunction · 0.50

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…