MCPcopy Create free account
hub / github.com/nodejs/node / #getError

Method #getError

deps/npm/lib/npm.js:371–393  ·  view source on GitHub ↗
(rawErr, opts)

Source from the content-addressed store, hash-verified

369 }
370
371 #getError (rawErr, opts) {
372 const { files = [], ...error } = require('./utils/error-message.js').getError(rawErr, {
373 npm: this,
374 command: this.#command,
375 ...opts,
376 })
377
378 const { writeFileSync } = require('node:fs')
379 for (const [file, content] of files) {
380 const filePath = `${this.logPath}${file}`
381 const fileContent = `'Log files:\n${this.logFiles.join('\n')}\n\n${content.trim()}\n`
382 try {
383 writeFileSync(filePath, fileContent)
384 error.detail.push(['', `\n\nFor a full report see:\n${filePath}`])
385 } catch (fileErr) {
386 log.warn('', `Could not write error message to ${file} due to ${fileErr}`)
387 }
388 }
389
390 outputError(error)
391
392 return error
393 }
394
395 get title () {
396 return this.#title

Callers 1

#handleErrorMethod · 0.95

Calls 6

writeFileSyncFunction · 0.85
outputErrorFunction · 0.85
warnMethod · 0.80
requireFunction · 0.50
joinMethod · 0.45
pushMethod · 0.45

Tested by

no test coverage detected