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

Function callbackifyOnRejected

lib/util.js:384–394  ·  view source on GitHub ↗
(reason, cb)

Source from the content-addressed store, hash-verified

382}
383
384const callbackifyOnRejected = (reason, cb) => {
385 // `!reason` guard inspired by bluebird (Ref: https://goo.gl/t5IS6M).
386 // Because `null` is a special error value in callbacks which means "no error
387 // occurred", we error-wrap so the callback consumer can distinguish between
388 // "the promise rejected with null" or "the promise fulfilled with undefined".
389 if (!reason) {
390 reason = new ERR_FALSY_VALUE_REJECTION.HideStackFramesError(reason);
391 ErrorCaptureStackTrace(reason, callbackifyOnRejected);
392 }
393 return cb(reason);
394};
395
396/**
397 * Converts a Promise-returning function to callback style

Callers

nothing calls this directly

Calls 1

cbFunction · 0.50

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…