(warning, type, code, ctor, detail)
| 185 | } |
| 186 | |
| 187 | function 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 | |
| 203 | module.exports = { |
| 204 | emitWarning, |
no test coverage detected
searching dependent graphs…