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

Function createWarningObject

lib/internal/process/warning.js:187–201  ·  view source on GitHub ↗
(warning, type, code, ctor, detail)

Source from the content-addressed store, hash-verified

185}
186
187function createWarningObject(warning, type, code, ctor, detail) {
188 assert(typeof warning === 'string');
189 // Improve error creation performance by skipping the error frames.
190 // They are added in the `captureStackTrace()` function below.
191 const tmpStackLimit = Error.stackTraceLimit;
192 if (isErrorStackTraceLimitWritable()) Error.stackTraceLimit = 0;
193 // eslint-disable-next-line no-restricted-syntax
194 warning = new Error(warning);
195 if (isErrorStackTraceLimitWritable()) Error.stackTraceLimit = tmpStackLimit;
196 warning.name = String(type || 'Warning');
197 if (code !== undefined) warning.code = code;
198 if (detail !== undefined) warning.detail = detail;
199 ErrorCaptureStackTrace(warning, ctor || process.emitWarning);
200 return warning;
201}
202
203module.exports = {
204 emitWarning,

Callers 2

emitWarningFunction · 0.85
emitWarningSyncFunction · 0.85

Calls 3

StringClass · 0.85
assertFunction · 0.50

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…