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

Method _getActivity

test/async-hooks/init-hooks.js:155–175  ·  view source on GitHub ↗
(uid, hook)

Source from the content-addressed store, hash-verified

153 }
154
155 _getActivity(uid, hook) {
156 const h = this._activities.get(uid);
157 if (!h) {
158 // If we allowed handles without init we ignore any further life time
159 // events this makes sense for a few tests in which we enable some hooks
160 // later
161 if (this._allowNoInit) {
162 const stub = { uid, type: 'Unknown', handleIsObject: true, handle: {} };
163 this._activities.set(uid, stub);
164 return stub;
165 } else if (!isMainThread) {
166 // Worker threads start main script execution inside of an AsyncWrap
167 // callback, so we don't yield errors for these.
168 return null;
169 }
170 const err = new Error(`Found a handle whose ${hook}` +
171 ' hook was invoked but not its init hook');
172 throw err;
173 }
174 return h;
175 }
176
177 _init(uid, type, triggerAsyncId, handle) {
178 const activity = {

Callers 4

_beforeMethod · 0.95
_afterMethod · 0.95
_destroyMethod · 0.95
_promiseResolveMethod · 0.95

Calls 2

getMethod · 0.65
setMethod · 0.45

Tested by

no test coverage detected